sleeps wait, cleaned up rake preview and rake watch a bit

main
Brandon Mathis 14 years ago
parent efb7522491
commit ebd5fb002b

@ -50,8 +50,6 @@ end
desc "Watch the site and regenerate when it changes" desc "Watch the site and regenerate when it changes"
task :watch do task :watch do
require 'compass'
require 'compass/exec'
puts "Starting to watch source with Jekyll and Compass." puts "Starting to watch source with Jekyll and Compass."
jekyllPid = spawn("jekyll --auto") jekyllPid = spawn("jekyll --auto")
compassPid = spawn("compass watch") compassPid = spawn("compass watch")
@ -59,9 +57,6 @@ require 'compass/exec'
trap("INT") { trap("INT") {
Process.kill(9, jekyllPid) Process.kill(9, jekyllPid)
Process.kill(9, compassPid) Process.kill(9, compassPid)
puts "Waiting for Jekyll and Compass to die."
sleep 5
puts "Done waiting. Bye bye."
exit 0 exit 0
} }
@ -79,9 +74,6 @@ task :preview do
Process.kill(9, jekyllPid) Process.kill(9, jekyllPid)
Process.kill(9, compassPid) Process.kill(9, compassPid)
Process.kill(9, rackupPid) Process.kill(9, rackupPid)
puts "Waiting for Jekyll, Compass and Rack to die."
sleep 10
puts "Done waiting. Bye bye."
exit 0 exit 0
} }
@ -92,12 +84,13 @@ end
desc "Begin a new post in #{source_dir}/#{posts_dir}" desc "Begin a new post in #{source_dir}/#{posts_dir}"
task :new_post, :title do |t, args| task :new_post, :title do |t, args|
require './plugins/titlecase.rb' require './plugins/titlecase.rb'
mkdir_p "#{source_dir}/#{posts_dir}"
args.with_defaults(:title => 'new-post') args.with_defaults(:title => 'new-post')
title = args.title title = args.title
filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}" filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}"
puts "Creating new post: #{filename}" puts "Creating new post: #{filename}"
open(filename, 'w') do |post| open(filename, 'w') do |post|
system "mkdir -p #{source_dir}/#{posts_dir}"; system "mkdir -p #{source_dir}/#{posts_dir}/";
post.puts "---" post.puts "---"
post.puts "layout: post" post.puts "layout: post"
post.puts "title: \"#{title.gsub(/&/,'&').titlecase}\"" post.puts "title: \"#{title.gsub(/&/,'&').titlecase}\""

Loading…
Cancel
Save