diff options
author | Benjamin R Doerr <tiggerizzy@gmail.com> | 2011-08-23 22:55:16 -0400 |
---|---|---|
committer | Benjamin R Doerr <tiggerizzy@gmail.com> | 2011-08-23 22:56:06 -0400 |
commit | efb752249105b6aba389f50148b8e30e8e89a625 (patch) | |
tree | b3be54d58e7b120d5a60421fb61c7fa190d4d1c4 | |
parent | 5f08abe6dd1ffd86ca5be730a1569553a1871f6d (diff) | |
download | my_new_personal_website-efb752249105b6aba389f50148b8e30e8e89a625.tar.xz my_new_personal_website-efb752249105b6aba389f50148b8e30e8e89a625.zip |
Do not rely on system specifc syntax for preview or watch.
Diffstat (limited to '')
-rw-r--r-- | Rakefile | 34 |
1 files changed, 32 insertions, 2 deletions
@@ -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") |