Add site namespace and rename site preview/publish rake tasks.

This commit is contained in:
Tom Preston-Werner 2012-12-28 16:09:42 -06:00
parent 6c02483255
commit 88bdb15338
1 changed files with 36 additions and 34 deletions

View File

@ -115,8 +115,9 @@ end
# #
############################################################################# #############################################################################
desc "Generate and view the site locally" namespace :site do
task :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 # 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. # then open it in a browser. Someday we can do better than this, I hope.
Thread.new do Thread.new do
@ -128,10 +129,10 @@ task :site do
# Generate the site in server mode. # Generate the site in server mode.
puts "Running Jekyll..." puts "Running Jekyll..."
sh "cd site && jekyll --server" sh "cd site && jekyll --server"
end end
desc "Commit the local site to the gh-pages branch and deploy" desc "Commit the local site to the gh-pages branch and deploy"
task :site_release do task :publish do
# Ensure the gh-pages dir exists so we can generate into it. # Ensure the gh-pages dir exists so we can generate into it.
puts "Checking for gh-pages dir..." puts "Checking for gh-pages dir..."
unless File.exist?("./gh-pages") unless File.exist?("./gh-pages")
@ -153,6 +154,7 @@ task :site_release do
sha = `git log`.match(/[a-z0-9]{40}/)[0] sha = `git log`.match(/[a-z0-9]{40}/)[0]
sh "cd gh-pages && git add . && git commit -m 'Updating to #{sha}.' && git push" sh "cd gh-pages && git add . && git commit -m 'Updating to #{sha}.' && git push"
puts 'Done.' puts 'Done.'
end
end end
############################################################################# #############################################################################