- Notifications
You must be signed in to change notification settings - Fork2
Gem to add man pages support to ruby gems
License
bitboxer/manpages
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This plugin will add man pages support to ruby gems. Insteadof adding a new command likegem-manit will try to link the files to a place theman
command automaticallydiscovers.
With rvm and chruby it works out of the box, but sadly for rbenv we need toadd hooks that modify theman
symlink depending onthe ruby version currently used.
gem install manpages && gem manpages --update-all
This plugin automatically hooks into the ruby gems system. Every geminstalled afterwards is checked for manpages. If this gem finds them, itexposes them to theman
command.
Sadly rbenv uses shims to hide the actual executables. This makes it a bitharder to make this gem work in that environment.
This gem provides hooks to change the man path for the current used ruby version.To install them execute the following line:
curl -o- https://raw.githubusercontent.com/bitboxer/manpages/master/rbenv/rbenv_hook_install.sh | bash
After the hooks are installed, rbenv will always change the man symlink to thecurrently used ruby version. Sadly rbenv does not provide a hook that is firedwhen switching ruby versions. This means that the path can only be correctedwhen executing a command provided by a gem. If you want to have the correctman page for a gem, you need to execute the command of that gem, first.
After a gem is installed, this plugin will check for a directory calledman
within thegem and link the manpages it finds toBIN_DIR/../share/man
, whereBIN_DIR
is thedirectory where the executable of the gem is installed.
Most man versions will automatically search this directory and no additional workis required. If you install a gem that includes a man page (e.g.guard), you cansimply useman guard
and you will see the man page the gem provided.
The most common way in the ruby world to create a man page is through a toolcalledronn. Ronn uses a modifiedvariant of markdown as source file. More details about the format can be foundhere.In the newest versionkramdown alsois able to generate man pages.
Make sure the resulting manpage is in a folder calledman
in the root of thegem. Files stored in that directory will automatically be exposed to theman
command.
About
Gem to add man pages support to ruby gems