Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Gem to add man pages support to ruby gems

License

NotificationsYou must be signed in to change notification settings

bitboxer/manpages

Repository files navigation

Build StatusGem

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.

Installation

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.

Using this with rbenv

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.

How this works

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.

Providing man pages with your gem

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.

Examples for gems with manpages areguard orgem-man.

About

Gem to add man pages support to ruby gems

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp