Skip to content

Instantly share code, notes, and snippets.

@blowmage
Created November 15, 2014 01:56
Show Gist options
  • Save blowmage/5aa2ee422c7e6619332a to your computer and use it in GitHub Desktop.
Save blowmage/5aa2ee422c7e6619332a to your computer and use it in GitHub Desktop.
A rake task to update the documentation in the gh-pages branch.
namespace :docs do
desc "Updates the documentation on the gh-pages branch"
task :update do
branch = `git symbolic-ref --short HEAD`.chomp
if "master" != branch
puts "You are on the #{branch} branch. You must be on the master branch to run this rake task."
exit
end
require_relative "../lib/my_gem/version.rb"
puts `git checkout gh-pages`
puts `git rm -rf doc/`
puts `git commit -am "Update documentation to #{MyGem::VERSION}"`
puts `git checkout master`
puts `rake docs`
puts `git add doc/`
puts `git checkout gh-pages`
puts `git add doc/`
puts `git commit --amend --no-edit`
puts `git checkout master`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment