diff --git a/Rakefile b/Rakefile index 87cbeb87..823c9434 100644 --- a/Rakefile +++ b/Rakefile @@ -115,44 +115,46 @@ end # ############################################################################# -desc "Generate and view the site locally" -task :site do - # 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. - Thread.new do - sleep 4 - puts "Opening in browser..." - sh "open http://localhost:4000" +namespace :site do + desc "Generate and view the site locally" + task :preview do + # 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. + Thread.new do + sleep 4 + puts "Opening in browser..." + sh "open http://localhost:4000" + end + + # Generate the site in server mode. + puts "Running Jekyll..." + sh "cd site && jekyll --server" end - # Generate the site in server mode. - puts "Running Jekyll..." - sh "cd site && jekyll --server" -end + desc "Commit the local site to the gh-pages branch and deploy" + task :publish do + # Ensure the gh-pages dir exists so we can generate into it. + puts "Checking for gh-pages dir..." + unless File.exist?("./gh-pages") + puts "No gh-pages directory found. Run the following commands first:" + puts " `git clone git@github.com:mojombo/god gh-pages" + puts " `cd gh-pages" + puts " `git checkout gh-pages`" + exit(1) + end -desc "Commit the local site to the gh-pages branch and deploy" -task :site_release do - # Ensure the gh-pages dir exists so we can generate into it. - puts "Checking for gh-pages dir..." - unless File.exist?("./gh-pages") - puts "No gh-pages directory found. Run the following commands first:" - puts " `git clone git@github.com:mojombo/god gh-pages" - puts " `cd gh-pages" - puts " `git checkout gh-pages`" - exit(1) + # Copy the rest of the site over. + puts "Copying static..." + Dir.glob("site/*") do |path| + next if path == "_site" + sh "cp -R #{path} gh-pages/" + end + + # Commit the changes + sha = `git log`.match(/[a-z0-9]{40}/)[0] + sh "cd gh-pages && git add . && git commit -m 'Updating to #{sha}.' && git push" + puts 'Done.' end - - # Copy the rest of the site over. - puts "Copying static..." - Dir.glob("site/*") do |path| - next if path == "_site" - sh "cp -R #{path} gh-pages/" - end - - # Commit the changes - sha = `git log`.match(/[a-z0-9]{40}/)[0] - sh "cd gh-pages && git add . && git commit -m 'Updating to #{sha}.' && git push" - puts 'Done.' end #############################################################################