Skip to content

Commit

Permalink
Add task for updating documentation
Browse files Browse the repository at this point in the history
This task will update the documentation in the gh-pages branch.
The master branch must be clean for this to work.
  • Loading branch information
blowmage committed Jan 27, 2015
1 parent 734574f commit 10b0e91
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
coverage
doc
keyfile.json

# directories left by gh-pages
_site
39 changes: 39 additions & 0 deletions rakelib/gh-pages.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

namespace :pages do
desc "Updates the documentation on the gh-pages branch"
task :master 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

commit_hash = `git rev-parse --short HEAD`.chomp

puts `git checkout gh-pages`
puts `git rm -rf docs/master`
puts `git commit -am "Update documentation for #{commit_hash}"`
puts `git checkout #{branch}`
puts `rake docs`
puts `mkdir docs`
puts `mv doc docs/master`
puts `git add docs/master`
puts `git checkout gh-pages`
puts `git add docs/master`
puts `git commit --amend --no-edit`
puts `git checkout #{branch}`
end
end

0 comments on commit 10b0e91

Please sign in to comment.