forked from json-api/json-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
33 lines (27 loc) · 758 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'redcard/1.9'
def preview(browser=false)
pids = [
Process.spawn("bundle exec jekyll serve --watch"),
Process.spawn("bundle exec scss --compass --watch stylesheets/")
]
if browser
STDERR.puts "Opening a browser to preview the site..."
STDERR.puts " You may need to refresh the page if the server hasn't loaded yet."
sleep 2
pids << Process.spawn("bundle exec launchy http://localhost:9876")
end
Signal.trap "INT" do
pids.each { |pid| Process.kill :INT, pid }
end
Process.waitall
end
desc "Build the site and host it localhost:9876"
task :preview do
preview
end
namespace :preview do
desc "Build the site and open localhost:9876 in the default browser"
task :browser do
preview true
end
end