Alrighty, FastRI is a sweet program written by Mauricio Fernandez (of eigenclass.org, which is down currently for some reason) for doing RI (Ruby Documentation) lookups very quickly, it supports doing all sorts of neat things like running a DRb server for lookups and other cool things
Anyway, if you found this, you probably don’t want to listen to me blabber, you want to know how to get it running on Ruby 1.9.x, so I humbly present a patch!
Download the patch here (older version) version 2
Download the patch here, version 3.
First, download the FastRI tarball (version 0.3.1 is latest at the time of this writing) from rubyforge.
Here’s how to install the patch:
% tar zxf fastri-0.3.1.tar.gz
% cd fastri-0.3.1
% patch -p1 < ../fastri-0.3.1-ruby1.9.1.v2.patch
patching file bin/fastri-server
patching file lib/fastri/ri_index.rb
patching file lib/fastri/ri_service.rb
patching file lib/fastri/util.rb
patching file test/test_functional_ri_service.rb
% sudo ruby setup.rb
And you’re done! Now you’ll need to make sure to do a ‘fastri-server -b
‘ to build the cache, and from there you can use FastRI the same as it was in Ruby 1.8, see:
[hinmanm@Xanadu:~]% qri String.each_codepoint
-------------------------------------------------- String#each_codepoint
str.each_codepoint {|integer| block } => str
From
------------------------------------------------------------------------
Passes the Integer ordinal of each character in str, also known as
a codepoint when applied to Unicode strings to the given block.
"hello\u0639".each_codepoint {|c| print c, ' ' }
produces:
104 101 108 108 111 1593
Notes/Caveats/Disclaimers & Warnings:
This patch is a WORK IN PROGRESS, it may hang, crash, steal your wallet and/or delete files. I hacked it up in a day looking at FastRI because I really like using ‘qri’ for everything and was consistently annoyed by getting docs intended for 1.8. I assume no responsibility for these things.
Also, note that all tests don’t pass with this patch, I’m still working on it.
Feel free to leave any feedback for me
UPDATE:
New version of the patch that fixes doing a lookup on a base class instead of a method. so… version 3 right now. (link above)
UPDATE2:
I created a github project for fastri to build a gem, so you can install the gem (without patching!) using this command:
sudo gem install dakrone-fastri -s http://gems.github.com
roger rubygems wrote:
could you perhaps create a github project for it? Then we could all install your gem more easily like “gem install xxx-fastri” and enjoy the bliss.
Or I could if you so desire.
-r
Link | July 17th, 2009 at 5:06 am
roger rubygems wrote:
oops forgot to check the “notify me of followup comments” box–this comment so that it will do so
Link | July 17th, 2009 at 5:06 am
Lee wrote:
Sure, I will create a github project for it later tonight and update the post with it. Good suggestion.
Link | July 17th, 2009 at 8:17 am
Lee wrote:
@Roger,
Alrighty, I’ve set up a project and had github build a gem, you can install it with ‘sudo gem install dakrone-fastri’. Enjoy!
Link | July 17th, 2009 at 12:00 pm
roger wrote:
suh weet. Maybe advertise it on ruby talk so people know?
=r
Link | July 20th, 2009 at 7:02 am
Lee wrote:
Next time someone mentions FastRI I will
Link | July 20th, 2009 at 10:01 pm
Bhrgunatha wrote:
I came across another problem – trying to build a full text index using fastri-server -B fails.
You can fix it by changing line 57 of fastri-server (in the make_full_text_index method) from:
paths = [ RI::Paths::SYSDIR, RI::Paths::SITEDIR, RI::Paths::HOMEDIR ].find_all do |p|
to
paths = [ ::RDoc::RI::Paths::SYSDIR, ::RDoc::RI::Paths::SITEDIR, ::RDoc::RI::Paths::HOMEDIR ].find_all do |p|
Link | November 2nd, 2009 at 9:26 pm
Moritz Bunkus wrote:
Unfortunately your patch doesn’t work right for me. It applies cleanly to fastri 0.3.1, no error messages, but whenever I invoke “fri” the output from fastri-server goes to fastri-server’s stdout, and “fri” itself only outputs a single blank line.
Any idea how to fix that?
Link | March 11th, 2010 at 3:15 am
roger wrote:
AS a note newer versions of RDoc have an ri lookup that is *much* faster.
Doing a gem install rdoc helps much in this regard.
For those looking for irb fastri you could checkout ri_for
http://github.com/rdp/ri_for
or such (or use fastri from here). That’s about your only options
-r
Link | March 11th, 2010 at 1:05 pm
Moritz Bunkus wrote:
My point is that “the fastri from here” doesn’t work properly for me. fastri-server outputs to its stdout which is totally useless as fastri-server is usually started as a daemon.
As for fastri in rb: yes, I did use it and I love it’s tab completion (well, that’s actually provided by “irb_lookup”). I didn’t know ri_for and will give it a try. irb_lookup has code for invoking ri instead of fri, so I’ll try that as well combined with the newer ri gem.
Link | March 11th, 2010 at 2:37 pm
Leonardo Valeri Manera wrote:
Here its failing with a superclass mismatch for class Paragraph from rdoc/markup/fragments.rb:4 on 1.9.1p429 Winstaller as soon as any part of fastri is called …
Link | August 5th, 2010 at 6:35 pm
Arnaud Meuret wrote:
Yes, same thing on Linux, it has been broken since at least ruby 1.9.1p376 (2009-12-07 revision 26041).
Sad.
Link | August 10th, 2010 at 4:46 am
Arnaud Meuret wrote:
Solved the superclass mismatch problem; now it works nicely.
All I had to do (after understanding the message, thanks to http://jackndempsey.blogspot.com/2008/06/superclass-mismatch.html) was get rid of old rdoc gems (sudo gem uni rdoc).
Link | August 10th, 2010 at 5:49 am