Publish Documentation to GitHub Pages
The github_pages_rake_tasks
gem creates a rake task that pushes files
from a local documentation directory to a remote Git repository branch.
By default, the rake task github-pages:publish
is created which pushes the doc
directory within the local copy of a repository to the same repository's
gh-pages
branch. The contents of the branch are completely replaced by the
contents of the documentation directory.
This task is useful for publishing rdoc
or yard
documentation using
GitHub Pages.
Installation
Add this line to your application's Gemfile:
gem 'github_pages_rake_tasks'
And then execute:
bundle
Or install it directly with the gem
command line:
gem install github_pages_rake_tasks
Usage
Add the github-pages:publish
task to Rake by adding the following lines in your Rakefile:
require 'github_pages_rake_tasks'
GitHubPagesRakeTasks::PublishTask.new
You can also configure the task by providing a block during initialization:
require 'github_pages_rake_tasks'
GitHubPagesRakeTasks::PublishTask.new do |task|
task.doc_dir = 'documentation'
task.repo_url = 'https://github.com/jcouball/github_pages_documentation'
task.branch_name = 'master'
end
An instance of GithubPagesRakeTasks::State
is passed to the initialization block (named task
in the example above).
See the full usage documentation for more details.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
.
To release a new version, update the version number in version.rb
, and then run
bundle exec rake release
, which will create a git tag for the version, push git
commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/jcouball/github_pages_rake_tasks.
Copyright and License
Copyright © 2019 James Couball. Free use of this software is granted under the terms of the MIT License. See LICENSE for details.