RVM, Adding documentation to installed ruby

October 13, 2010

One challenge when running a number of rvm rubies and gemsets, is having access to the documentation for the gems in your current gemset.

I like to use Hanna for documenting my gems, and have no need for ri, so I have my ~/.gemrc setup as

rdoc: -f hanna
gem: --no-ri

This causes problems with new rubies, and especially with anything that wants to install the latest rdoc (incompatible with the default hanna).

What I need to do is install particular gems for each ruby so I can document things consistently, ideally allowing any new gemset to generate all the documentation I need.

To do this I have to install a particular hanna gem to the @global gemset of the particular ruby.

    ➥  rvm 1.8.7-p302@global
    ➥  gem install ~/Repos/hanna/hanna-0.1.13.gem 
    ... # snipped lots of stuff about rdoc-data
    Successfully installed rdoc-2.5.11
    Successfully installed haml-2.2.24
    Successfully installed hanna-0.1.13
    3 gems installed
    Installing RDoc documentation for rdoc-2.5.11...
    Installing RDoc documentation for haml-2.2.24...
    Installing RDoc documentation for hanna-0.1.13..

I will also install bdoc as its my preferred tool for quickly viewing gem documentation.

    ➥  gem install bdoc
    Building native extensions.  This could take a while...
    Successfully installed configuration-1.1.0
    Successfully installed launchy-0.3.7
    Successfully installed json-1.4.6
    Successfully installed bdoc-0.2.2
    4 gems installed
    Installing RDoc documentation for configuration-1.1.0...
    Installing RDoc documentation for launchy-0.3.7...
    Installing RDoc documentation for json-1.4.6...
    Installing RDoc documentation for bdoc-0.2.2...

The hanna I am using is from a fork by raggi and has a master branch compatible with the latest rdoc. I have cloned the repo and built the gem locally.

This approach could have problems if the gems installed clash with gems needed by a particular project, but I'll deal with that when/if it happens.