Created
November 15, 2014 01:56
-
-
Save blowmage/5aa2ee422c7e6619332a to your computer and use it in GitHub Desktop.
A rake task to update the documentation in the gh-pages branch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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