aboutsummaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Rakefile34
1 files changed, 32 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index 7c442741..7f53ff16 100644
--- a/Rakefile
+++ b/Rakefile
@@ -50,12 +50,42 @@ end
desc "Watch the site and regenerate when it changes"
task :watch do
- system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; wait"
+require 'compass'
+require 'compass/exec'
+ puts "Starting to watch source with Jekyll and Compass."
+ jekyllPid = spawn("jekyll --auto")
+ compassPid = spawn("compass watch")
+
+ trap("INT") {
+ Process.kill(9, jekyllPid)
+ Process.kill(9, compassPid)
+ puts "Waiting for Jekyll and Compass to die."
+ sleep 5
+ puts "Done waiting. Bye bye."
+ exit 0
+ }
+
+ Process.wait
end
desc "preview the site in a web browser"
task :preview do
- system "trap 'kill $jekyllPid $compassPid $rackPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; rackup --port #{server_port} & rackPid=$!; wait"
+ puts "Starting to watch source with Jekyll and Compass. Starting Rack on port #{server_port}"
+ jekyllPid = spawn("jekyll --auto")
+ compassPid = spawn("compass watch")
+ rackupPid = spawn("rackup --port #{server_port}")
+
+ trap("INT") {
+ Process.kill(9, jekyllPid)
+ Process.kill(9, compassPid)
+ Process.kill(9, rackupPid)
+ puts "Waiting for Jekyll, Compass and Rack to die."
+ sleep 10
+ puts "Done waiting. Bye bye."
+ exit 0
+ }
+
+ Process.wait
end
# usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post")