Browse code

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

Brandon Mathis authored on 25/08/2011 at 14:05:22
Showing 1 changed files
... ...
@@ -50,21 +50,16 @@ end
50 50
 
51 51
 desc "Watch the site and regenerate when it changes"
52 52
 task :watch do
53
-require 'compass'
54
-require 'compass/exec'
55 53
   puts "Starting to watch source with Jekyll and Compass."
56 54
   jekyllPid = spawn("jekyll --auto")
57 55
   compassPid = spawn("compass watch")
58
-  
59
-  trap("INT") { 
56
+
57
+  trap("INT") {
60 58
 	Process.kill(9, jekyllPid)
61 59
 	Process.kill(9, compassPid)
62
-	puts "Waiting for Jekyll and Compass to die."
63
-	sleep 5
64
-	puts "Done waiting. Bye bye."
65 60
 	exit 0
66 61
   }
67
-  
62
+
68 63
   Process.wait
69 64
 end
70 65
 
... ...
@@ -73,18 +68,15 @@ task :preview do
73 73
   puts "Starting to watch source with Jekyll and Compass. Starting Rack on port #{server_port}"
74 74
   jekyllPid = spawn("jekyll --auto")
75 75
   compassPid = spawn("compass watch")
76
-  rackupPid = spawn("rackup --port #{server_port}")  
77
-  
78
-  trap("INT") { 
76
+  rackupPid = spawn("rackup --port #{server_port}")
77
+
78
+  trap("INT") {
79 79
 	Process.kill(9, jekyllPid)
80 80
 	Process.kill(9, compassPid)
81 81
 	Process.kill(9, rackupPid)
82
-	puts "Waiting for Jekyll, Compass and Rack to die."
83
-	sleep 10
84
-	puts "Done waiting. Bye bye."
85 82
 	exit 0
86 83
   }
87
-  
84
+
88 85
   Process.wait
89 86
 end
90 87
 
... ...
@@ -92,12 +84,13 @@ end
92 92
 desc "Begin a new post in #{source_dir}/#{posts_dir}"
93 93
 task :new_post, :title do |t, args|
94 94
   require './plugins/titlecase.rb'
95
+  mkdir_p "#{source_dir}/#{posts_dir}"
95 96
   args.with_defaults(:title => 'new-post')
96 97
   title = args.title
97 98
   filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}"
98 99
   puts "Creating new post: #{filename}"
99 100
   open(filename, 'w') do |post|
100
-    system "mkdir -p #{source_dir}/#{posts_dir}";
101
+    system "mkdir -p #{source_dir}/#{posts_dir}/";
101 102
     post.puts "---"
102 103
     post.puts "layout: post"
103 104
     post.puts "title: \"#{title.gsub(/&/,'&').titlecase}\""