3

There is a command bundle in ruby.

I want use man command or similar function for bundle. Does it exist? If there is it, I want to know how to look for separated command like bundle gem.

I can see it online, but I prefer to read it in command line. http://bundler.io/v1.12/man/bundle-gem.1.html

5

Definitely, the bundle-gem online manual was created from the bundle-gem.ronn file. And ronn is a format (and program) meant to be formatted as a man page.

First let's get the files (for bundler-gem and ronn):

git clone https://github.com/bundler/bundler.git
gem install ronn  # this actually depends on mustache, rdiscount and hpricot

And create the man page:

$ /home/grochmal/.gem/ruby/2.3.0/bin/ronn -r bundler/man/bundle-gem.ronn 
     roff: bundler/man/bundle-gem.1

(You probably have the gem path in PATH, but I added it here just in case. Also -r stands for roff i.e. the format used for man pages)

And see the manpage:

man bundler/man/bundle-gem.1

If you want the manpage to show when you do man bundle-gem place it somewhere sensible and add that place to MANPATH. For example:

mkdir ~/man{,/man1}
cp bundler/man/bundle-gem.1 ~/man/man1/
export MANPATH=$MANPATH:~/man

(Note the use of man sections here)


Extra notes

Since ronn uses hpricot you can use ronn -5 <file.ronn> to generate that web manual you were reading.

gem will run ronn for you, therefore if you installed bundler with gem you will have the manual page in ~/.gem/ruby/<version>/gems/bundler-<version>/man. Unfortunately gem does not follow the *nix convention of dividing man sections into directories (man1, man2, ...), therefore it may be troublesome to retrieve the man pages from ~/.gem (using MANPATH isn't an option here).

If you do not have MANPATH set yet, then your system is using /etc/man_db.conf. In that case you should set MANPATH as:

export MANPATH=`manpath`:~/man
  • A gem sometimes installs its own ronnified man pages. On my system, for instance, one can run man -l /var/lib/gems/2.3.0/gems/bundler-1.13.2/lib/bundler/man/bundle-gem . – Mark Plotnick Oct 7 '16 at 1:35
  • @MarkPlotnick - Wow, I never noticed that. Thanks, I'm wiser now. I made an overhaul of the answer as well to add that info. – grochmal Oct 7 '16 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.