RDoc, ri and gem server

May 4th, 2008

Installing Documentation

You can view the Rails API and other documentation on your local machine instead of the online Rails API. To do this install Rails API, gem documentation and other docs on local machine, by running these command's

1
2
# Install ri, RDoc, documentation
gem rdoc --all

Now the rdocs should be available to the gem server.

NOTE: When you install new gems there is no rdoc and ri documentation generated for it by default, but you can easily install it with

1
2
# Generates RDOC documentation for the given $gemname
gem rdoc $gemname

Gem Server - View local documentation in your browser

To view the local rails documentation in a web browser you need to start the gem server, and then browse http://localhost:8808

1
2
3
4
# Start gem_server
> gem server
# Open web browser
firefox http://localhost:8808

ri - View documenation from the command line

1
2
# View the documentation for the method zip from the Enumerable class
ri Enumberable#zip

or with color

1
2
# View the documentation for the method gsub from the String class
ri -Tf ansi String#gsub

Leave a Reply