docs/Rakefile
# coding: utf-8
namespace :site do
desc "Serve site"
task :serve do
sh "bundle exec jekyll serve --draft --future --livereload"
end
desc "Build jekyll and push to gh-pages branch"
task :build do
# Clone to gh-pages
unless File.exist?("gh-pages")
sh "git clone -b gh-pages https://github.com/crispgm/caravan.git gh-pages"
end
# Checkout and pull
Dir.chdir("gh-pages") do
sh "git checkout gh-pages"
sh "git pull origin gh-pages"
end
# Build site
Dir.chdir(".") do
sh "bundle exec jekyll build --destination=./gh-pages/"
end
# Push
Dir.chdir("gh-pages") do
sh "git add ."
sh "git commit --allow-empty -m \"Deployed at #{Time.now}\""
sh "git push origin gh-pages"
end
end
end