[ANN] FastRI 0.1.0: faster, smarter RI docs for Ruby, DRb-enabled

FastRI 0.1.0: faster, smarter RI docs for Ruby, DRb-enabled

FastRI can be installed with RubyGems:
  gem install fastri
(if you get an old version/a 404 error, please allow some time after the
release until the package propagates to the RubyForge mirrors). Please read
below for an important note regarding the RubyGems packages.

Additional information, tarballs... at
  http://eigenclass.org/hiki.rb?fastri

Overview

···

========
FastRI is an alternative to the ri command-line tool. It is *much* faster, and
also allows you to offer RI lookup services over DRb. FastRI is smarter than
ri, and can find classes anywhere in the hierarchy without specifying the
"full path". It also knows about gems, and can tell you e.g. which extensions
to a core class were added by a specific gem.

Usage

There are two parts to FastRI:
* the server: fastri-server
* the client: fri

FastRI uses a Rinda Ring to allow servers to be discovered automatically
without needing to indicate the DRb URIs manually. It can work across
machines if you make sure the ring server is bound to the correct interface,
and the ACL permissions are correct.

Examples

$ fastri-server (creates the index on the first run, blocks)

Later,
$ fri Array#fetch

Speed

fri is much faster than ri; here are some times measured with a cold cache:

$ time fri -f plain Array#fetch
------------------------------------------------------------ Array#fetch
      array.fetch(index) -> obj
[...]
real 0m0.287s (real 0m0.127s with a hot cache)
user 0m0.048s
sys 0m0.008s

Compare to:
$ time ri -T -f plain Array#fetch
------------------------------------------------------------ Array#fetch
[...]
real 0m10.136s (real ~ 1.5s with a hot cache)
user 0m1.140s
sys 0m0.464s

Smart searches

This illustrates FastRI's ability to locate classes deep in the class
hierarchy:

$ fri Base
------------------------------------------------------ Multiple choices:

      ActionMailer::Base, ActionView::Base, ActionWebService::API::Base,
      ActionWebService::Base, ActionWebService::Client::Base,
      ActiveRecord::Base, MapReduce::ActiveRecord::Base,
      RSS::Maker::Base, Scruffy::Components::Base,
      Scruffy::Formatters::Base, Scruffy::Layers::Base,
      Scruffy::Renderers::Base, Scruffy::Themes::Base

$ fri Themes::Base
------------------------------------------- Class: Scruffy::Themes::Base
      Scruffy::Themes::Base
      Author: Brasten Sager

      Date: August 14th, 2006

Compare to
$ ri Themes::Base .... several seconds later ...
Nothing known about Themes::Base

A note about RubyGems + FastRI

RubyGems adds a noticeable overhead to fri, making it run slower than if you
installed it directly from the tarball with setup.rb.

Compare the execution time when installed with RubyGems:
  $ time fri -f plain String > /dev/null

  real 0m0.385s
  user 0m0.244s
  sys 0m0.036s

to the time fri actually takes to run, without the overhead introduced by
RubyGems:
  $ time ruby bin/fri -f plain String > /dev/null

  real 0m0.088s
  user 0m0.040s
  sys 0m0.008s

If you care about those extra 300ms (and there are situations where they will
matter, e.g. when using fri for method completion), get FastRI from the
tarballs.

Thanks

rubikitch
---------
* command-line options to load/build the index
* testing and suggestions

Kristof Bastiaensen
-------------------
For showing the way with ri-emacs.rb.

License

FastRI is licensed under the same terms as Ruby. See LICENSE.

Feedback

Bug reports, patches, comments... are appreciated.
You can contact the author via <mfp@acm.org>. Please add "fastri" to the
subject in order to bypass the spam filters.

--
Mauricio Fernandez - http://eigenclass.org - singular Ruby

Thanks for this. I see it's not working so well on Windows yet.
The script is looking for directory '~' and there are some display problems.

I also saw another bug when looking for things that are not indexed,
but I'll test it on Linux/BSD before I say any more.

Les

:fr Mauricio Julio Fernández Pradier
# FastRI 0.1.0: faster, smarter RI docs for Ruby, DRb-enabled

another cool lib/app fr Mauricio. Thanks.

btw, Mauricio, i installed using tar setup.rb in windows and it can't find fastri-server and fri. I had to rename both files by appending the .rb extension.

it's working like a charm now and indeed it IS VERY FAST. no more pause. thanks again!

kind regards -botp

btw, how do i time it windows? use ruby and benchmark perhaps like,

time_start = Time.now
system ARGV.join(" ")
puts "#{Time.now - time_start} seconds"

?

feature request: i hope fri remove the case sensitivity.
eg,

C:\Documents and Settings\peñaijm>fri string.split
nil

I'm trying to serve my docs from one machine and have them available on the local network, but its failing to start...

~$ fastri-server -a 192.168.1.0 -s 192.168.1.100
Looking for Ring server...
No Ring server found, starting my own.
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__': Insecure operation - require__ (SecurityError)
         from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
         from /usr/lib/ruby/gems/1.8/gems/fastri-0.1.0.1/bin/fastri-server:142
         from /usr/bin/fastri-server:18

So are there any more docs available? What am I missing from the above?

···

--
Craig Beck

AIM: kreiggers

Mauricio;

Very nice! Ri definitely can use the speedup.

One thing I noticed is that it blows up if you don't have rubygems
installed--I know, probably not very likely at this point; I only
noticed because I'm still setting up a new laptop and I saw your note
about the tarball being faster.

lou@aurora:~/src/fastri-0.1.0$ fastri-server
Building index.
/usr/local/lib/site_ruby/1.8/fastri/ri_index.rb:192:in
`rebuild_index': uninitialized constant FastRI::RiIndex::Gem
(NameError)
        from /usr/local/lib/site_ruby/1.8/fastri/ri_index.rb:189:in
`rebuild_index'
        from /usr/local/lib/site_ruby/1.8/fastri/ri_index.rb:177:in
`new_from_paths'
        from /usr/bin/fastri-server:43:in `make_index'
        from /usr/bin/fastri-server:93

So I installed gems and now it's working correctly.

Anyway, thanks again for the great work.

···

--
Lou.

How do you get it to index ruby gems?

thanks,
dom

···

On 11/8/06, Mauricio Fernandez <mfp@acm.org> wrote:

FastRI 0.1.0: faster, smarter RI docs for Ruby, DRb-enabled

FastRI can be installed with RubyGems:
  gem install fastri
(if you get an old version/a 404 error, please allow some time after the
release until the package propagates to the RubyForge mirrors). Please
read
below for an important note regarding the RubyGems packages.

Additional information, tarballs... at
  http://eigenclass.org/hiki.rb?fastri

Overview

FastRI is an alternative to the ri command-line tool. It is *much* faster,
and
also allows you to offer RI lookup services over DRb. FastRI is smarter
than
ri, and can find classes anywhere in the hierarchy without specifying the
"full path". It also knows about gems, and can tell you e.g. which
extensions
to a core class were added by a specific gem.

Usage

There are two parts to FastRI:
* the server: fastri-server
* the client: fri

FastRI uses a Rinda Ring to allow servers to be discovered automatically
without needing to indicate the DRb URIs manually. It can work across
machines if you make sure the ring server is bound to the correct
interface,
and the ACL permissions are correct.

Examples

$ fastri-server (creates the index on the first run, blocks)

Later,
$ fri Array#fetch

Speed

fri is much faster than ri; here are some times measured with a cold
cache:

$ time fri -f plain Array#fetch
------------------------------------------------------------ Array#fetch
      array.fetch(index) -> obj
[...]
real 0m0.287s (real 0m0.127s with a hot cache)
user 0m0.048s
sys 0m0.008s

Compare to:
$ time ri -T -f plain Array#fetch
------------------------------------------------------------ Array#fetch
[...]
real 0m10.136s (real ~ 1.5s with a hot cache)
user 0m1.140s
sys 0m0.464s

Smart searches

This illustrates FastRI's ability to locate classes deep in the class
hierarchy:

$ fri Base
------------------------------------------------------ Multiple choices:

      ActionMailer::Base, ActionView::Base, ActionWebService::API::Base,
      ActionWebService::Base, ActionWebService::Client::Base,
      ActiveRecord::Base, MapReduce::ActiveRecord::Base,
      RSS::Maker::Base, Scruffy::Components::Base,
      Scruffy::Formatters::Base, Scruffy::Layers::Base,
      Scruffy::Renderers::Base, Scruffy::Themes::Base

$ fri Themes::Base
------------------------------------------- Class: Scruffy::Themes::Base
      Scruffy::Themes::Base
      Author: Brasten Sager

      Date: August 14th, 2006

Compare to
$ ri Themes::Base .... several seconds later ...
Nothing known about Themes::Base

A note about RubyGems + FastRI

RubyGems adds a noticeable overhead to fri, making it run slower than if
you
installed it directly from the tarball with setup.rb.

Compare the execution time when installed with RubyGems:
  $ time fri -f plain String > /dev/null

  real 0m0.385s
  user 0m0.244s
  sys 0m0.036s

to the time fri actually takes to run, without the overhead introduced by
RubyGems:
  $ time ruby bin/fri -f plain String > /dev/null

  real 0m0.088s
  user 0m0.040s
  sys 0m0.008s

If you care about those extra 300ms (and there are situations where they
will
matter, e.g. when using fri for method completion), get FastRI from the
tarballs.

Thanks

rubikitch
---------
* command-line options to load/build the index
* testing and suggestions

Kristof Bastiaensen
-------------------
For showing the way with ri-emacs.rb.

License

FastRI is licensed under the same terms as Ruby. See LICENSE.

Feedback

Bug reports, patches, comments... are appreciated.
You can contact the author via <mfp@acm.org>. Please add "fastri" to the
subject in order to bypass the spam filters.

--
Mauricio Fernandez - http://eigenclass.org - singular Ruby

I must be missing something.
My fastri founds much less documentation than ri.

Shell output follows:

   piastrella:~$ fastri-server -b
   Building index.
   Indexed:
   * 7565 methods
   * 1316 classes/modules
   Needed 1.764042 seconds
   piastrella:~$ fastri-server
   Looking for Ring server...
   No Ring server found, starting my own.
   fastri-server 0.0.1 (FastRI 0.1.1) listening on druby://127.0.0.1:49772
   ACL:
   deny all
   allow 127.0.0.1
   ^Z
   [1]+ Stopped fastri-server
   piastrella:~$ bg
   [1]+ fastri-server &
   piastrella:~$ fri find|wc -l
          3
   piastrella:~$ ri find|wc -l
         53
   piastrella:~$ uname -a
   Darwin piastrella.local 8.8.0 Darwin Kernel Version 8.8.0: Fri Sep 8 17:18:57 PDT 2006; root:xnu-792.12.6.obj~1/RELEASE_PPC Power Macintosh powerpc
   piastrella:~$ ruby -v
   ruby 1.8.5 (2006-08-25) [powerpc-darwin8.8.0]

I'm using Mac OS X 10.4.8.
Both fastri and ruby should be up to date.

Could it be because Mac OS X has a broken installation of ruby by default, and it's usually installed a new version in /usr/local as [1] says? It's even suggested by Apple itself ([2]).
Maybe fastri is confused about where to look.
I've just read other response in this thread, but I couldn't find anything like this: am I the only Mac user who tried fastri within this mailing list?

Anyway, how do I fix this? :slight_smile:

[1]: http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger
[2]: http://developer.apple.com/tools/rubyonrails.html

I have pushed a patch to the 0.1 branch
(http://eigenclass.org/repos/fastri/0.1/ ) that solves the HOME issue. Until
that gets released, specifying the file as in
  fastri-server --index-file c:/tmp/fastri-index
should work.

As for the "display problems", are they due to ANSI escape sequences? If so,
fri -f plain should do. If win32 can't handle ANSI escape codes, I can set
the default format based on the platform at runtime.

BTW, I'd appreciate feedback regarding execution times, both for indexing and
lookups (and if possible, both with cold & hot cache).

On an older K7 XP 1800+ running Linux, it takes under 10 seconds to index 36
gems (out of 88 installed ones --- I grabbed a bunch for testing purposes;
multiple versions are coalesced and some packages have no documentation) with
over 13000 entries (classes/modules & methods), and under 2 seconds when the
OS' cache is doing its work. I bet it'll be slower on win32, IO is much slower
in general (ri+RubyGems must be The Pain).

(note: the docs will only be indexed once, unless you remove the index file or
specify another one; otherwise it will be reused in successive runs)

  $ fastri-server
  Indexing RI docs for ParseTree version 1.5.0.
  Indexing RI docs for Rubilicious version 0.2.0.
  Indexing RI docs for ZenTest version 3.4.1.
  Indexing RI docs for actionmailer version 1.2.5.
  Indexing RI docs for actionpack version 1.12.5.
  Indexing RI docs for actionwebservice version 1.1.6.
  Indexing RI docs for activerecord version 1.14.4.
  Indexing RI docs for activesupport version 1.3.1.
  Indexing RI docs for builder version 2.0.0.
  Indexing RI docs for call_stack version 0.1.0.0.
  Indexing RI docs for cmdparse version 2.0.2.
  Indexing RI docs for color-tools version 1.3.0.
  Indexing RI docs for dev-utils version 1.0.1.
  Indexing RI docs for extensions version 0.6.0.
  Indexing RI docs for fastercsv version 0.2.1.
  Indexing RI docs for fastri version 0.1.0.1.
  Indexing RI docs for highline version 1.2.1.
  Indexing RI docs for hoe version 1.1.2.
  Indexing RI docs for mailfactory version 1.2.3.
  Indexing RI docs for mime-types version 1.15.
  Indexing RI docs for pdf-writer version 1.1.3.
  Indexing RI docs for rails_analyzer_tools version 1.1.0.
  Indexing RI docs for rake version 0.7.1.
  Indexing RI docs for rcov version 0.7.0.1.
  Indexing RI docs for rspec version 0.6.4.
  Indexing RI docs for ruby-breakpoint version 0.5.1.
  Indexing RI docs for ruby-debug version 0.4.2.
  Indexing RI docs for rubyforge version 0.3.1.
  Indexing RI docs for rubyful_soup version 1.0.4.
  Indexing RI docs for ruport version 0.5.3.
  Indexing RI docs for scruffy version 0.2.2.
  Indexing RI docs for sqlite3-ruby version 1.1.0.
  Indexing RI docs for starfish version 1.2.0.
  Indexing RI docs for sys-proctable version 0.7.3.
  Indexing RI docs for tidy version 1.1.2.
  Indexing RI docs for transaction-simple version 1.3.0.
  Building index.
  Indexed:
  * 11131 methods
  * 2287 classes/modules
  Needed 9.553382 seconds
  Looking for Ring server...
  Located Ring server at druby://127.0.0.1:50275
  fastri-server 0.0.1 (FastRI 0.1.0) listening on druby://127.0.0.1:42913
  ACL:
  deny all
  allow 127.0.0.1

  $ fastri-server --index-file /tmp/Index2
  Indexing RI docs for ParseTree version 1.5.0.
[...]
  Building index.
  Indexed:
  * 11131 methods
  * 2287 classes/modules
  Needed 1.761658 seconds
  Looking for Ring server...

···

On Thu, Nov 09, 2006 at 12:31:29AM +0900, Leslie Viljoen wrote:

Thanks for this. I see it's not working so well on Windows yet.
The script is looking for directory '~' and there are some display problems.

--
Mauricio Fernandez - http://eigenclass.org - singular Ruby

:fr Mauricio Julio Fernández Pradier
# FastRI 0.1.0: faster, smarter RI docs for Ruby, DRb-enabled
btw, Mauricio, i installed using tar setup.rb in windows and it can't find
fastri-server and fri. I had to rename both files by appending the .rb
extension.

I'll try to fix that in one of setup.rb's hooks, I'm always bumping into it :slight_smile:

btw, how do i time it windows? use ruby and benchmark perhaps like,

time_start = Time.now
system ARGV.join(" ")
puts "#{Time.now - time_start} seconds"

What about something like this:

$ cat runner.rb
#!/usr/bin/env ruby

program = ARGV.shift

unless program
  puts <<E
ruby runner.rb <progname> [arguments]
E
  exit
end

found = false
t0 = Time.new

at_exit do
  tms = Process.times
  $stderr.puts <<EOF

real #{Time.new - t0}
user #{tms.cutime}
sys #{tms.cstime}
EOF
end

system("ruby", "-S", program, *ARGV)

__END__

I don't know if cutime and cstime are meaningful on win32, though.

feature request: i hope fri remove the case sensitivity.
eg,

C:\Documents and Settings\peñaijm>fri string.split
nil

Seems convenient, I'll implement it.

···

On Thu, Nov 09, 2006 at 10:47:40AM +0900, Peña, Botp wrote:

--
Mauricio Fernandez - http://eigenclass.org - singular Ruby

I'm trying to serve my docs from one machine and have them available
on the local network, but its failing to start...

~$ fastri-server -a 192.168.1.0 -s 192.168.1.100

···

On Thu, Nov 09, 2006 at 12:07:36PM +0900, Craig Beck wrote:
                     ============
You might need to specify for instance 192.168.1.0/24 (this is passed to
DRb's ACL object directly, and I haven't checked which formats it accepts).

Looking for Ring server...
No Ring server found, starting my own.
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require__': Insecure operation - require__ (SecurityError)
        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:
21:in `require'
        from /usr/lib/ruby/gems/1.8/gems/fastri-0.1.0.1/bin/fastri-
server:142
        from /usr/bin/fastri-server:18

So are there any more docs available? What am I missing from the above?

My bad, I was doing require 'enumerator' after $SAFE=1. I've fixed it in the
0.1 branch (http://eigenclass.org/repos/fastri/0.1/ ) and I'll be releasing
0.1.1 later today with this and other fixes.

--
Mauricio Fernandez - http://eigenclass.org - singular Ruby

Thanks for reporting this; I've wrapped that code with
  begin
    require 'rubygems'
    ....
  rescue LoadError
  end
so that it doesn't try to infer package names from the full path if RubyGems
is not installed. I've pushed the patch to the online 0.1 branch, and it will
be in 0.1.1 later today.

···

On Thu, Nov 09, 2006 at 12:46:42PM +0900, Louis J Scoras wrote:

One thing I noticed is that it blows up if you don't have rubygems
installed--I know, probably not very likely at this point; I only
noticed because I'm still setting up a new laptop and I saw your note
about the tarball being faster.

lou@aurora:~/src/fastri-0.1.0$ fastri-server
Building index.
/usr/local/lib/site_ruby/1.8/fastri/ri_index.rb:192:in
`rebuild_index': uninitialized constant FastRI::RiIndex::Gem
(NameError)
       from /usr/local/lib/site_ruby/1.8/fastri/ri_index.rb:189:in
`rebuild_index'
       from /usr/local/lib/site_ruby/1.8/fastri/ri_index.rb:177:in
`new_from_paths'
       from /usr/bin/fastri-server:43:in `make_index'
       from /usr/bin/fastri-server:93

So I installed gems and now it's working correctly.

--
Mauricio Fernandez - http://eigenclass.org - singular Ruby

fastri-server searches "#{Gem.path}/doc/*/ri" for yaml files holding RI
documentation when it builds the index (the first time you run it and when you
do fastri-server -b). These files are generated by RubyGems as you install
the corresponding package (since 0.9.0).

Unlike ri, FastRI remembers in which gem a method/class/module was defined.
This knowledge will soon be exposed to the end-user, allowing you to know e.g.
which gems extend a given core class, or to get the extensions introduced by a
gem.

···

On Tue, Nov 14, 2006 at 02:13:00AM +0900, Dominic Sisneros wrote:

On 11/8/06, Mauricio Fernandez <mfp@acm.org> wrote:
>FastRI is an alternative to the ri command-line tool. It is *much* faster,
>and also allows you to offer RI lookup services over DRb. FastRI is smarter
>than ri, and can find classes anywhere in the hierarchy without specifying
>the "full path". It also knows about gems, and can tell you e.g. which
>extensions to a core class were added by a specific gem.

How do you get it to index ruby gems?

--
Mauricio Fernandez - http://eigenclass.org - singular Ruby

I must be missing something.
My fastri founds much less documentation than ri.

Shell output follows:

  piastrella:~$ fastri-server -b
  Building index.
  Indexed:
  * 7565 methods
  * 1316 classes/modules
  Needed 1.764042 seconds

[...]

  piastrella:~$ fri find|wc -l
         3
  piastrella:~$ ri find|wc -l
        53

There are a couple explanations for this. From most to least important:

(1)
FastRI's search strategy is more sophisticated than ri's and it will try
several methods successively, yielding the results as soon as there's a match
(if it's unique, you get the description, otherwise a disambiguation message).

$ fri -h
Usage: fri [options] <query>
    -s, --bind ADDR Bind to ADDR for incoming DRb connections.
                                     (default: 127.0.0.1)
    -O, --order ORDER Specify lookup order.
                                     (default: eEnNpPxX)
                                     Uppercase: case-indep.
                                     e:exact n:nested p:partial (completion)
                                     x:nested and partial
        --show-matches Only show matching entries.
    -S, --full-text Perform full-text search.
[...]

The default search strategy is eEnNpPxX, which means that it will try in this
order
(a) exact matches
(b) "nested matching": Foo#bar -> ActiveBar::Foo#bar & ActiveAction::Baz::Foo#bar
(c) partial matching: Foo#bar -> Foo#bar_whatever & Foo#bartender
(d) partial + nested: Foo#bar -> ActiveFoo::Foo#bartz & A::b::Foo#bart_foo

When you do fri find, since there's no exact match, by default fri will fall
back to "nested matching", yielding all methods named "find" under any
class/module:

$ fri find
------------------------------------------------------ Multiple choices:

     ActiveRecord::Base.find, Daemons::Monitor.find, Enumerable#find,
     Find#find, Pathname#find, Rinda::TupleBag#find, TagModule#find

By contrast, ri will return any methods matching /find/ (e.g. both
Foo#do_find_foo and Bar#find_dsad) when it doesn't find an exact match.

fri's search strategy can be specified with the -O option. You can make it
behave more like ri with -O aA:

$ fri -O aA find
------------------------------------------------------ Multiple choices:

     ActionController::TestProcess#find_all_tag,
     ActionController::TestProcess#find_tag,
[...]
     TestAutotest#util_find_files_to_test,
     TestSexp#test_find_and_replace_all, URI::Generic#find_proxy,
[...]
     WSDL::XMLSchema::ComplexType#find_element_by_name,
     XSD::NamedElements#find_name

$ fri -O aA find --show-matches | wc -l
95

(2) ri doesn't handle multiple versions of a gem correctly

$ ri -T ActiveRecord::Base::find
More than one method matched your request. You can refine
your search by asking for information on one of:

     ActiveRecord::Base::find, ActiveRecord::Base::find_by_sql,
     ActiveRecord::Base::find, ActiveRecord::Base::find_by_sql,
     ActiveRecord::Base::find, ActiveRecord::Base::find_by_sql,
     ActiveRecord::Base::validate_find_options,
     ActiveRecord::Base::find, ActiveRecord::Base::find_by_sql,
     ActiveRecord::Base::validate_find_options,
     ActiveRecord::Base::find, ActiveRecord::Base::find_by_sql,
     ActiveRecord::Base::validate_find_options,
     ActiveRecord::Base::find, ActiveRecord::Base::find_by_sql,
     ActiveRecord::Base::validate_find_options

vs.

$ fri Base.find
----------------------------------------------- ActiveRecord::Base::find
     ActiveRecord::Base::find(*args)

···

On Tue, Nov 14, 2006 at 06:26:15PM +0900, Gabriele Marrone wrote:
                                     a:match method name anywhere
------------------------------------------------------------------------
[...]

So there are probably many repeated entries in your ri find|wc -l

Could it be because Mac OS X has a broken installation of ruby by
default, and it's usually installed a new version in /usr/local as
[1] says? It's even suggested by Apple itself ([2]).
Maybe fastri is confused about where to look.

I believe that wasn't the case (FastRI looks for RI docs in the same dirs as
ri anyway), since:

  piastrella:~$ fastri-server -b
  Building index.
  Indexed:
  * 7565 methods
  * 1316 classes/modules

You can get the full list of instance methods known to FastRI with

$ fri --show-matches "#"

Here "#" matches any instance method; in order to get all singleton
(class/module) methods, you'd do
$ fri --show-matches ::

And to get both,

$ fri --show-matches .

--
Mauricio Fernandez - http://eigenclass.org - singular Ruby

As for the "display problems", are they due to ANSI escape sequences? If so,
fri -f plain should do. If win32 can't handle ANSI escape codes, I can set
the default format based on the platform at runtime.

Yes, it was escape codes. I'll try plain.

BTW, I'd appreciate feedback regarding execution times, both for indexing and
lookups (and if possible, both with cold & hot cache).

Here you go, on a 1.6GHz Pentium-M:

Indexing RI docs for ZenTest version 3.4.1.
Indexing RI docs for actionmailer version 1.2.5.
Indexing RI docs for actionpack version 1.12.5.
Indexing RI docs for actionwebservice version 1.1.6.
Indexing RI docs for activerecord version 1.14.4.
Indexing RI docs for activesupport version 1.3.1.
Indexing RI docs for color-tools version 1.3.0.
Indexing RI docs for composite_primary_keys version 0.7.2.
Indexing RI docs for fastercsv version 0.2.1.
Indexing RI docs for fastri version 0.1.0.1.
Indexing RI docs for flexmock version 0.4.3.
Indexing RI docs for fxruby-1.2.6 version mswin32.
Indexing RI docs for fxruby-1.6.0 version mswin32.
Indexing RI docs for gruff version 0.1.2.
Indexing RI docs for hoe version 1.1.2.
Indexing RI docs for log4r version 1.0.5.
Indexing RI docs for mailfactory version 1.2.3.
Indexing RI docs for mime-types version 1.15.
Indexing RI docs for net-ping version 1.1.1.
Indexing RI docs for pdf-writer version 1.1.3.
Indexing RI docs for rake version 0.7.1.
Indexing RI docs for ruby-breakpoint version 0.5.1.
Indexing RI docs for rubyforge version 0.3.1.
Indexing RI docs for ruport version 0.4.21.
Indexing RI docs for transaction-simple version 1.3.0.
Indexing RI docs for win32-clipboard version 0.4.0.
Indexing RI docs for win32-dir-0.3.0 version mswin32.
Indexing RI docs for win32-eventlog-0.4.1 version mswin32.
Indexing RI docs for win32-file-0.5.2 version mswin32.
Indexing RI docs for win32-file-stat-1.2.2 version mswin32.
Indexing RI docs for win32-process-0.4.2 version mswin32.
Indexing RI docs for win32-sapi-0.1.3 version mswin32.
Indexing RI docs for win32-sound version 0.4.0.
Indexing RI docs for windows-pr-0.5.1 version mswin32.
Building index.
Indexed:
* 8391 methods
* 1384 classes/modules
Needed 13.209 seconds
Looking for Ring server...
No Ring server found, starting my own.
fastri-server 0.0.1 (FastRI 0.1.0) listening on druby://127.0.0.1:1310
ACL:
deny all
allow 127.0.0.1

···

On 11/8/06, Mauricio Fernandez <mfp@acm.org> wrote:

On Thu, Nov 09, 2006 at 12:31:29AM +0900, Leslie Viljoen wrote:

I get some strange responses on Windows. I'll test on Linux shortly.

c:\Program Files\Microsoft Visual Studio 8\VC>fri -f plain assert
------------------------------------------------------ Breakpoint#assert
     assert(context = nil, &condition) {|| ...}

···

------------------------------------------------------------------------
     This asserts that the block evaluates to true. If it doesn't
     evaluate to true a breakpoint will automatically be created at that
     execution point.

     You can disable assert checking in production code by setting
     Breakpoint.optimize_asserts to true. (It will still be enabled when
     Ruby is run via the -d argument.)

     Example:

       person_name = "Foobar"
       assert { not person_name.nil? }

     Note: If you want to use this method from an unit test, you will
     have to call it by its full name, Breakpoint.assert.

c:\Program Files\Microsoft Visual Studio 8\VC>fri -f plain assert_not_same
nil

c:\Program Files\Microsoft Visual Studio 8\VC>fri -f plain Test::Unit
(druby://127.0.0.1:1310) c:/ruby/lib/ruby/1.8/rdoc/ri/ri_descriptions.rb:99:in `
concat': can't convert nil into Array (TypeError)
        from (druby://127.0.0.1:1310) c:/ruby/lib/ruby/1.8/rdoc/ri/ri_descriptio
ns.rb:99:in `merge_in'
        from (druby://127.0.0.1:1310) c:/ruby/lib/ruby/gems/1.8/gems/fastri-0.1.
0.1/lib/fastri/ri_index.rb:323:in `get_class'
        from (druby://127.0.0.1:1310) c:/ruby/lib/ruby/gems/1.8/gems/fastri-0.1.
0.1/lib/fastri/ri_index.rb:319:in `get_class'
        from (druby://127.0.0.1:1310) c:/ruby/lib/ruby/gems/1.8/gems/fastri-0.1.
0.1/lib/fastri/ri_service.rb:174:in `info'
        from (druby://127.0.0.1:1310) c:/ruby/lib/ruby/gems/1.8/gems/fastri-0.1.
0.1/lib/fastri/ri_service.rb:259:in `capture_stdout'
        from (druby://127.0.0.1:1310) c:/ruby/lib/ruby/gems/1.8/gems/fastri-0.1.
0.1/lib/fastri/ri_service.rb:173:in `info'
        from (druby://127.0.0.1:1310) c:/ruby/lib/ruby/1.8/drb/drb.rb:1552:in `p
erform_without_block'
        from (druby://127.0.0.1:1310) c:/ruby/lib/ruby/1.8/drb/drb.rb:1512:in `p
erform'
         ... 7 levels...
        from (druby://127.0.0.1:1310) c:/ruby/lib/ruby/gems/1.8/gems/fastri-0.1.
0.1/bin/fastri-server:113
        from (druby://127.0.0.1:1310) c:/ruby/bin/fastri-server:18
        from c:/ruby/lib/ruby/gems/1.8/gems/fastri-0.1.0.1/bin/fri:66
        from c:/ruby/bin/fri:18

:fr Mauricio Julio Fernández Pradier
# > feature request: i hope fri remove the case sensitivity. eg,
# > C:\Documents and Settings\peñaijm>fri string.split
# > nil

···

#
# Seems convenient, I'll implement it.

wow, thanks much, Mauricio.

btw, i installed fastri 0.1.0.1 using rubygems on another mswindows pc. The install went fine but when i started to run fastri-server, it balked. The program cannot find the HOME var. So what I did was just create it and equate it like HOME=%HOMEDIR%+%HOMEPATH%. Everything went fine then... (note, not all win pcs have HOME var set)

kind regards -botp

:From Mauricio Julio Fernández Pradier
# FastRI remembers in which gem a
# method/class/module was defined.
# This knowledge will soon be exposed to the end-user, allowing
# you to know e.g. which gems extend a given core class, or to get the
# extensions introduced by a gem.

+1 again for that.
thanks -botp

# Mauricio Fernandez - http://eigenclass.org - singular Ruby

···

#
#

Thanks,

I had to update my rubygems and then rebuild the fastri index and it is now
working!

dom

···

On 11/13/06, Mauricio Fernandez <mfp@acm.org> wrote:

On Tue, Nov 14, 2006 at 02:13:00AM +0900, Dominic Sisneros wrote:
> On 11/8/06, Mauricio Fernandez <mfp@acm.org> wrote:
> >FastRI is an alternative to the ri command-line tool. It is *much*
faster,
> >and also allows you to offer RI lookup services over DRb. FastRI is
smarter
> >than ri, and can find classes anywhere in the hierarchy without
specifying
> >the "full path". It also knows about gems, and can tell you e.g. which
> >extensions to a core class were added by a specific gem.
>
> How do you get it to index ruby gems?

fastri-server searches "#{Gem.path}/doc/*/ri" for yaml files holding RI
documentation when it builds the index (the first time you run it and when
you
do fastri-server -b). These files are generated by RubyGems as you
install
the corresponding package (since 0.9.0).

Unlike ri, FastRI remembers in which gem a method/class/module was
defined.
This knowledge will soon be exposed to the end-user, allowing you to know
e.g.
which gems extend a given core class, or to get the extensions introduced
by a
gem.

--
Mauricio Fernandez - http://eigenclass.org - singular Ruby

[...]
There are a couple explanations for this. From most to least important:

(1)
FastRI's search strategy is more sophisticated than ri's and it will try
several methods successively, yielding the results as soon as there's a match
(if it's unique, you get the description, otherwise a disambiguation message).

[...]
(2) ri doesn't handle multiple versions of a gem correctly

Thank you for your detailed answer.
The latter one was actually the case: I had many duplicated gems; 'gem cleanup', 'gem rdoc -all', 'fastri-server -b' did the job.
Now everything works :slight_smile:

Thank you!

···

On 15/nov/06, at 00:02, Mauricio Fernandez wrote:

--
Mauricio Fernandez - http://eigenclass.org - singular Ruby

--
Gabriele Marrone

Ah, on Linux the output is a bit different. No error for the third line:

root@kadima:/etc# fri assert
------------------------------------------------------ Multiple choices:

     Test::Rails::ControllerTestCase#assert_assigned,
     Test::Rails::ControllerTestCase#assert_content_type,
     Test::Rails::ControllerTestCase#assert_flash,
     Test::Rails::ViewTestCase#assert_error_on,
     Test::Rails::ViewTestCase#assert_field,
     Test::Rails::ViewTestCase#assert_image,
     Test::Rails::ViewTestCase#assert_input,
     Test::Rails::ViewTestCase#assert_label,
     Test::Rails::ViewTestCase#assert_links_to,
     Test::Rails::ViewTestCase#assert_multipart_form,
     Test::Rails::ViewTestCase#assert_post_form,
     Test::Rails::ViewTestCase#assert_select_tag,
     Test::Rails::ViewTestCase#assert_submit,
     Test::Rails::ViewTestCase#assert_tag_in_form,
     Test::Rails::ViewTestCase#assert_text_area,
     Test::Unit::Assertions#assert_empty,
     Test::Unit::Assertions#assert_includes,
     TestRailsViewTestCase#assert_tag
root@kadima:/etc# fri assert_not_nil
nil
root@kadima:/etc# fri Test::Unit
------------------------------------------------------ Class: Test::Unit
     (no description...)

···

------------------------------------------------------------------------