Get Sinatra, Rubygems, and Passenger working for offline RDocs? Count me in. I saw this and new I had to have it. I’ve been on some long plane rides recently and I frequently find myself wanting to look up something from a gem’s documentation while I’m coding. You can use the
gem server command but that’s just such a pain to do every time you want to look something up. I hadn’t really given it much thought that there might be an easier way until I saw Jesse’s tweet about it. Having this offline using passenger at http://gems.local is great but I wanted to have a little more searching baked in. Here’s how I did it:
- Install the hanna gem from mislav.
- Tell rdoc to use the hanna theme
In order to tell rdoc and gem to use this when you use the "gem" command, you need to add to your .gemrc. Beware that this will affect all future rdoc generation when you install a gem. Add the following to ~/.gemrc:
- Regenerate your rdocs
You then need to regenerate all of your rdocs with this theme. You can do this by executing the following:
- Get sinatra-rubygems
git clone git://github.com/jseifer/sinatra-rubygems.git
- Add it to Passenger
Hook it up to your passenger preference pane and set the name to "gems.local", restart Apache and you’ll be all set:
After you complete the above steps, everything should be working. Enjoy! This will come in handy next time you don’t have internet access and need to look up some methods. I’d like to give a special thanks to Jesse Newland for releasing the sinatra-rubygems app.
Update: k776 points out in the comments that this doesn’t work on the latest version of rdoc, which is 2.4.1 as of this writing. It seems 2.3.0 is the version to go with.