This is ruby gem that provides a simple command line tool that helps open gem documentation. There are two documentation sources this gem supports.
- local gems served with the yard gem via
yard server --gems
oryard server --gemfile
accessible at http://localhost:8808. - https://gemdocs.org - a good ruby gem documentation host
- If ran from a directory with a Gemfile.lock, it will open the documentation for the version specified in Gemfile.lock. When using the online source, you can specify
--latest
or--version
options. - Defaults to open the latest version of the documentation if not
--local
or aGemfile.lock
is not found in the current directory. - Can specify a version of the docs to view
- When ran with
--local
, it will either serve docs for all gems you have installed or the versions specified in your Gemfile.
Install the gem and add to the application's Gemfile by executing:
bundle add open_gemdocs --group development
If bundler is not being used to manage dependencies, install the gem by executing:
gem install open_gemdocs
Currently, this only works on Macs because of the open
command. It opens the documentation for a gem in your default web browser.
To see the available options.
open-gem-docs --help
If you are in a directory with a Gemfile.lock, it will open the documentation for the version of the gem you are using unless you specify --latest
or --version
options.
If you are not in a directory with a Gemfile.lock, it will open the latest version of the documentation.
open-gem-docs rspec
(Assuming you are in a directory with a Gemfile.lock, it will open the rspec docs for the version you are using.)
Open a specific version (regardless of what is in your Gemfile.lock)
open-gem-docs -v 3.12.0 rspec
Open the latest version of the documentation
open-gem-docs --latest rspec
To use a local documentation server. Run the following command from a directory where Gemfile.lock exists. This will serves the documentation for your currently installed gems.
open-gem-docs --local
You can also jump directly to a local doc gem page:
open-gem-docs --local rspec
If you prefer the --local
option to be the default, you can use the open-local-docs
command instead of open-gem-docs
.
Example using the open-local-docs
command:
open-local-docs rspec
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 the created tag, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/mrinterweb/open_gemdocs.
The gem is available as open source under the terms of the MIT License.