Jabberwocky

Pretty docs for rubygems

Posted in ruby by elisehuard on December 1, 2009

Tip I got through my colleague Bart Duchesne:
to have nicer templates for the rubygem documentation, you can use templates.
Mislav’s Hanna templates are pretty decent (way better than the default ones anyway) – there are other options if you look around.

Howto (updated from this site):

  1. gem install hanna
  2. follow the instructions given here – best to put following line in your .gemrc
    rdoc: --inline-source --line-numbers --format=html --template=hanna
  3. to regenerate all rdoc
    sudo gem rdoc --all --no-ri
  4. install the sinatra-rubygems (after having installed sinatra – gem install sinatra – if you haven’t got it already)
    git clone git://github.com/jseifer/sinatra-rubygems.git
    It’s a web application (duh) so keep this in mind in choosing where you want to clone it
  5. point your apache+passenger (replace by suitable web server) to
    directory/sinatra-rubygems/public
    (and give it its own port, of course)
  6. bookmark the link in the toolbar of your favourite browser
  7. Update: rather than using apache and sinatra, you could also install bdoc
    sudo gem install bdoc
    – no extra web servers needed ! and build the necessary index typing
    bdoc
    this will start up the index in the default browser, and the UI is even nicer
    (thanks to Josh Kim for the tip)
    doesn’t seem to work under ubuntu, I’ll see if I can fix it

You can add a cherry on top by also doing the same for your ruby, by fooling your system into thinking it’s also a gem.

They say laziness is a virtue in programmers: voila, you have your ruby documentation just a click away, and offline too.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: