From 599cd4e07c59c92fa863f6eb8431394e3813411c Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Mon, 22 Aug 2011 17:24:02 -0400 Subject: [PATCH 1/5] updated date now shows up properly --- .themes/classic/source/_includes/post/date.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.themes/classic/source/_includes/post/date.html b/.themes/classic/source/_includes/post/date.html index f1ed481..dce9247 100644 --- a/.themes/classic/source/_includes/post/date.html +++ b/.themes/classic/source/_includes/post/date.html @@ -6,5 +6,5 @@ {% endif %} {% if was_updated != '0' %} - + {% endif %} From 9d57455e0ff376a39ce46a788b4ee636a19ca3af Mon Sep 17 00:00:00 2001 From: Ben Doerr Date: Tue, 23 Aug 2011 03:22:18 -0300 Subject: [PATCH 2/5] Makes update_source and update_style much more windows friendly. --- Rakefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 6838b18..6b06963 100644 --- a/Rakefile +++ b/Rakefile @@ -136,7 +136,8 @@ task :update_style, :theme do |t, args| end system "mv sass sass.old" puts "## Moved styles into sass.old/" - system "mkdir -p sass; cp -R #{themes_dir}/"+theme+"/sass/ sass/" + system "mkdir -p sass" + system "cp -R #{themes_dir}/"+theme+"/sass/ sass/" cp_r "sass.old/custom/.", "sass/custom" puts "## Updated Sass ##" end @@ -150,7 +151,8 @@ task :update_source, :theme do |t, args| end system "mv #{source_dir} #{source_dir}.old" puts "moved #{source_dir} into #{source_dir}.old/" - system "mkdir -p #{source_dir}; cp -R #{themes_dir}/"+theme+"/source/. #{source_dir}" + system "mkdir -p #{source_dir}" + system "cp -R #{themes_dir}/"+theme+"/source/. #{source_dir}" system "cp -Rn #{source_dir}.old/. #{source_dir}" system "cp -Rf #{source_dir}.old/_includes/custom/. #{source_dir}/_includes/custom/" system "mv -f #{source_dir}/index.html #{blog_index_dir}" if blog_index_dir != source_dir From 5f08abe6dd1ffd86ca5be730a1569553a1871f6d Mon Sep 17 00:00:00 2001 From: Benjamin R Doerr Date: Mon, 22 Aug 2011 22:46:04 -0400 Subject: [PATCH 3/5] Removes system specific File IO from Rakefile, rather we make use of FileUtils. --- Rakefile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Rakefile b/Rakefile index 6b06963..7c44274 100644 --- a/Rakefile +++ b/Rakefile @@ -124,7 +124,7 @@ end desc "Clean out caches: _code_cache, _gist_cache, .sass-cache" task :clean do - system "rm -rf _code_cache/** _gist_cache/** .sass-cache/** source/stylesheets/screen.css" + rm_rf ["_code_cache/**", "_gist_cache/**", ".sass-cache/**", "source/stylesheets/screen.css"] end desc "Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom" @@ -132,12 +132,12 @@ task :update_style, :theme do |t, args| theme = args.theme || 'classic' if File.directory?("sass.old") puts "removed existing sass.old directory" - system "rm -r sass.old" + rm_r "sass.old", :secure=>true end - system "mv sass sass.old" + mv "sass", "sass.old" puts "## Moved styles into sass.old/" - system "mkdir -p sass" - system "cp -R #{themes_dir}/"+theme+"/sass/ sass/" + mkdir_p "sass" + cp_r "#{themes_dir}/"+theme+"/sass/", "sass" cp_r "sass.old/custom/.", "sass/custom" puts "## Updated Sass ##" end @@ -147,16 +147,16 @@ task :update_source, :theme do |t, args| theme = args.theme || 'classic' if File.directory?("#{source_dir}.old") puts "removed existing #{source_dir}.old directory" - system "rm -r #{source_dir}.old" + rm_r "#{source_dir}.old", :secure=>true end - system "mv #{source_dir} #{source_dir}.old" + mv source_dir, "#{source_dir}.old" puts "moved #{source_dir} into #{source_dir}.old/" - system "mkdir -p #{source_dir}" - system "cp -R #{themes_dir}/"+theme+"/source/. #{source_dir}" - system "cp -Rn #{source_dir}.old/. #{source_dir}" - system "cp -Rf #{source_dir}.old/_includes/custom/. #{source_dir}/_includes/custom/" - system "mv -f #{source_dir}/index.html #{blog_index_dir}" if blog_index_dir != source_dir - system "cp -f #{source_dir}.old/index.html #{source_dir}" if blog_index_dir != source_dir + mkdir_p source_dir + cp_r "#{themes_dir}/"+theme+"/source/.", source_dir + cp_r "#{source_dir}.old/.", source_dir, :preserve=>true + cp_r "#{source_dir}.old/_includes/custom/.", "#{source_dir}/_includes/custom/" + mv "#{source_dir}/index.html", "#{blog_index_dir}", :force=>true if blog_index_dir != source_dir + cp "#{source_dir}.old/index.html", source_dir if blog_index_dir != source_dir puts "## Updated #{source_dir} ##" end From efb752249105b6aba389f50148b8e30e8e89a625 Mon Sep 17 00:00:00 2001 From: Benjamin R Doerr Date: Tue, 23 Aug 2011 22:55:16 -0400 Subject: [PATCH 4/5] Do not rely on system specifc syntax for preview or watch. --- Rakefile | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 7c44274..7f53ff1 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") From ebd5fb002bebd4a2bd18d172758256dcd42475d7 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Thu, 25 Aug 2011 10:05:22 -0400 Subject: [PATCH 5/5] sleeps wait, cleaned up rake preview and rake watch a bit --- Rakefile | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/Rakefile b/Rakefile index 7f53ff1..5881764 100644 --- a/Rakefile +++ b/Rakefile @@ -50,21 +50,16 @@ end desc "Watch the site and regenerate when it changes" task :watch do -require 'compass' -require 'compass/exec' puts "Starting to watch source with Jekyll and Compass." jekyllPid = spawn("jekyll --auto") compassPid = spawn("compass watch") - - trap("INT") { + + 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 @@ -73,18 +68,15 @@ task :preview do 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") { + 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 @@ -92,12 +84,13 @@ end desc "Begin a new post in #{source_dir}/#{posts_dir}" task :new_post, :title do |t, args| require './plugins/titlecase.rb' + mkdir_p "#{source_dir}/#{posts_dir}" args.with_defaults(:title => 'new-post') title = args.title filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}" puts "Creating new post: #{filename}" open(filename, 'w') do |post| - system "mkdir -p #{source_dir}/#{posts_dir}"; + system "mkdir -p #{source_dir}/#{posts_dir}/"; post.puts "---" post.puts "layout: post" post.puts "title: \"#{title.gsub(/&/,'&').titlecase}\""