The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Unleashing ri

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Hodel

Posts: 660
Nickname: drbrain
Registered: Mar, 2006

Eric Hodel is a long-time Rubyist and co-founder of Seattle.rb.
Unleashing ri Posted: Aug 27, 2006 6:27 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eric Hodel.
Original Post: Unleashing ri
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eric Hodel
Latest Posts From Segment7

Advertisement
Now that ruby 1.8.5 has been released (Changelog) and ri includes a bunch more documentation and integrates with gems you just might be suffering from ri overload.
$ ri --system -l | wc -l
    8882
$ ri -l | wc -l
   11918
$ echo 11918 - 8882 | bc
3036
I have 31 extra gems installed, including Rails, which gives me a ton more at-my-fingertips documentation! Some people would rather have less documentation, and there are a handful of new options that control where ri will search for documentation.
$ ri -h
[...]

  --doc-dir, -d <dirname>
                  A directory to search for documentation. If not
                  specified, we search the standard rdoc/ri directories.
                  May be repeated.

       --system   Include documentation from Ruby's standard library:
                    /usr/local/share/ri/1.8/system

         --site   Include documentation from libraries installed in site_lib:
                    /usr/local/share/ri/1.8/site

         --home   Include documentation stored in ~/.rdoc:
                    /Users/drbrain/.rdoc

         --gems   Include documentation from Rubygems:
                    /usr/local/lib/ruby/gems/1.8/doc/*/ri

[...]
Options may also be passed in the 'RI' environment variable
$
I've set my RI environment variable is -T -f ansi to turn off the pager and give me fancy colors, but you can do mix-and-match options to your liking. To only search the system libraries by default, export RI='--system'. To make an alias that searches only rails documentation:
alias rri="ri -d /usr/local/lib/ruby/gems/1.8/doc/actionmailer*/ri \
              -d /usr/local/lib/ruby/gems/1.8/doc/actionpack*/ri \
              -d /usr/local/lib/ruby/gems/1.8/doc/actionwebservice*/ri \
              -d /usr/local/lib/ruby/gems/1.8/doc/activerecord*/ri \
              -d /usr/local/lib/ruby/gems/1.8/doc/activesupport*/ri \
              -T -f ansi"
(If you have multiple rails versions you'll need to explicitly list the versions of each gem.)
$ rri ActiveRecord::Base.find
----------------------------------------------- ActiveRecord::Base::find
     ActiveRecord::Base::find(*args)
------------------------------------------------------------------------
     Find operates with three different retrieval approaches:

[...]
Also, note that if you install multiple versions of a gem you'll either need to run gem cleanup and remove the old versions or manually remove their ri if you want the older versions to hang around. If you don't, you might get duplicate documentation.

Read: Unleashing ri

Topic: Ruby 1.8.5 Released Previous Topic   Next Topic Topic: Of snakes and rubies; Or why I chose Python over Ruby

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use