My RDoc Setup

I used to keep rdoc and ri turned off to speed up gem installs via my .gemrc config. This became problematic recently when I was planning on doing some work while traveling, and knew I wouldn’t have an always on internet connection to get my documentation fix. I recalled a post by Jason Seifer I had seen that described how to generate your docs with a better template and host them as a passenger application. I decided to use that as a starting point to getting my docs generated in a format I liked and setting things up so that they would always be generated that way.

Jason’s instructions tell us to install the “hanna” template via `gem install mislav-hanna` which is out of date, so we will use the most current instructions from the gems github page to install the template. No big deal, just drop the github username from the gem install command like this…

The “hanna” template absolutely kills the default rdoc template. You’ve probably seen it around being used by various projects and there’s no reason not to use it locally.

Next I updated my .gemrc to ignore ri and to use the “hanna” template for rdocs.

Finally I re-generated my rdocs by running:

I ignored the rest of the steps in the aforementioned post as I don’t really feel the need to be running a passenger instance just to serve rubygems docs. I generally just run `gem server` whenever I need to access my local docs.

My solution is barely more than what you get out of the box with rubygems but with just a few changes I find myself much happier with my local docs.

This entry was posted on Monday, March 8th, 2010 at 8:55 pm and is filed under Ruby, RubyGems, Self Reference. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

5 Responses to “My RDoc Setup”

  1. Jonathan Julian Says:

    “hanna” is a rockin theme, thanks for showing me that! One note, I had to add the –overwrite flag to my gem rdoc command to regenerate all my docs.

  2. Ed Says:

    @Jonathan good catch. I didn’t run into that since I started without any rdoc generated. Post updated.

  3. Mike Subelsky Says:

    I also didn’t want to run a server just for gemdocs, but found this nice bash function that works awesomely:

    gemdoc() {
    local gems=($GEMDIR/doc/$1*/rdoc/index.html)
    open ${gems[@]: -1}
    }

  4. Ed Says:

    @Mike I’m using something (can’t figure out what) that adds commands to gem so that I can say `gem read rails` to view the local rdoc for that gem or `gem open rails` to open the source for that gem.

  5. Erik Ostrom Says:

    `gem read` is provided by the `open_gem` gem.

Leave a Reply