From 774c65a869aa2e6dddc6e36a28af74a3f25f3c4c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 5 Nov 2014 11:13:04 -0800 Subject: [PATCH] Add a rake site:generate command and use Ruby instead of a subprocess. --- Rakefile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 2fa5d7f0..439a5366 100644 --- a/Rakefile +++ b/Rakefile @@ -134,6 +134,7 @@ namespace :site do desc "Generate and view the site locally" task :preview do require "launchy" + require "jekyll" # Yep, it's a hack! Wait a few seconds for the Jekyll site to generate and # then open it in a browser. Someday we can do better than this, I hope. @@ -145,9 +146,19 @@ namespace :site do # Generate the site in server mode. puts "Running Jekyll..." - Dir.chdir("site") do - sh "#{File.expand_path('bin/jekyll', File.dirname(__FILE__))} serve" - end + Jekyll::Commands::Serve.process({ + "source" => File.expand_path("site"), + "destination" => File.expand_path("site/_site") + }) + end + + desc "Generate the site" + task :generate => [:history, :version_file] do + require "jekyll" + Jekyll::Commands::Build.process({ + "source" => File.expand_path("site"), + "destination" => File.expand_path("site/_site") + }) end desc "Update normalize.css library to the latest version and minify"