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 S.

  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 B.

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 [email protected]. Please add “fastri” to the
subject in order to bypass the spam filters.

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

On Thu, Nov 09, 2006 at 12:31:29AM +0900, Leslie V. 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.

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…

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.

[email protected]:~/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:inrebuild_index’
from /usr/local/lib/site_ruby/1.8/fastri/ri_index.rb:177:in
new_from_paths' from /usr/bin/fastri-server:43:inmake_index’
from /usr/bin/fastri-server:93

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

Anyway, thanks again for the great work.

On 11/8/06, Mauricio F. [email protected] wrote:

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

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

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:inmerge_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:inget_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:incapture_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:inp
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

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:inrequire’
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 B.

AIM: kreiggers

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

[email protected]:/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

[email protected]:/etc# fri assert_not_nil
nil
[email protected]:/etc# fri Test::Unit
------------------------------------------------------ Class: Test::Unit
(no description…)

:fr Leslie V. [mailto:[email protected]]

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)

fyi, it does not fail here:

C:\Documents and Settings\botp>fri -f plain Test::Unit
------------------------------------------------------ Class: Test::Unit

TEST::UNIT - RUBY UNIT TESTING FRAMEWORK

Introduction

 Unit testing is making waves all over the place, largely due to the
 fact that it is a core practice of XP. While XP is great, unit
 testing has been around for a long time and has always been a good
 idea. One of the keys to good unit testing, though, is not just
 writing tests, but having tests. What's the difference? Well, if
 you just _write_ a test and throw it away, you have no guarantee
 that something won't change later which breaks your code. If, on
 the other hand, you _have_ tests (obviously you have to write them
 first), and run them as often as possible, you slowly build up a
 wall of things that cannot break without you immediately knowing

[snip long text]

C:\Documents and Settings\botp>ver
Microsoft Windows XP [Version 5.1.2600]

C:\Documents and Settings\botp>ruby -v
ruby 1.8.5 (2006-08-25) [i386-mswin32]

kind regards -botp

On Thu, Nov 09, 2006 at 12:07:36PM +0900, Craig B. wrote:

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
============
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).

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.

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

   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:innew_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.

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 10:47:40AM +0900, Peña, Botp wrote:

: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 [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.

: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

On Fri, Nov 10, 2006 at 10:58:47AM +0900, Peña, Botp wrote:

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)

Should be fixed in 0.1.1, which I just released, as well as the issue
with
executable extensions (and all the other problems reported on this
thread).
Now the search strategy can be specified, and includes case-independent
variants, so:

$ fri string.split
----------------------------------------------------------- String#split
str.split(pattern=$;, [limit]) => anArray

 Divides str into substrings based on a delimiter, returning an
 array of these substrings.

[…]

The less specific you are, the longer a lookup can take, but fri’s
slowest
search modes are still much faster than ri :slight_smile:

Here’s case-independent, nested, partial matching at work:

$ fri writer.rend
----------------------------------------------------- PDF::Writer#render
render(debug = false)

On Thu, Nov 09, 2006 at 06:05:40PM +0900, Leslie V. 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
[…]
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_descriptions.rb:99:inmerge_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)

As far as I can see from this and your other message,

  • your Ruby install in Windows is missing the core/stdlib RI
    documentation;
    that’s the reason why Test::Unit::Assertions#assert isn’t found when
    FastRI
    falls back to “nested” matches (i.e. exact method name matches
    anywhere in
    the hierarchy), and you get Breakpoint#assert instead of ‘multiple
    choices’
  • the RI docs in your Linux install might be incomplete;
    Test::Unit::Assertions#assert should have been found before falling
    back to
    “nested+partial” matches.
  • as for the above TypeError: it looks like a bug in
    rdoc/ri/ri_descriptions.rb (ModuleDescription#merge_in), but my copy
    says:

88 # merge in another class desscription into this one
89 def merge_in(old)
90 merge(@class_methods, old.class_methods)
91 merge(@instance_methods, old.instance_methods)
92 merge(@attributes, old.attributes)
93 merge(@constants, old.constants)
94 merge(@includes, old.includes)
95 if @comment.nil? || @comment.empty?
96 @comment = old.comment
97 else
98 unless old.comment.nil? or old.comment.empty? then
99 @comment << SM::Flow::RULE.new
100 @comment.concat old.comment
101 end
102 end
103 end

The test in line 98 should have prevented the TypeError, but in your
backtrace
#concat is called in line 99 (instead of 100 as in my copy). Maybe
you’ve got
an older version that does not include line 98 above?

$ ruby -v
ruby 1.8.5 (2006-08-25) [i686-linux]

On Sat, Nov 11, 2006 at 11:18:53AM +0900, Peña, Botp wrote:

tried it on my win box, and yes! it works! very fast yet cool indeed.

btw, Mauricio, how do i troubleshoot the fri? is there a log somewhere?

Not right now, but it will be added (we really want this if
fastri-server is
to run as a daemon).

I have a problem with one of my linux box running ubuntu6.10, ruby1.8.5,
gem0.9, and rails1.1.6. The install went fine, the fri server is running,
but when i query thru fri, eg fri String#upcase, the result returns nil; in
fact, all queries returns nil. tips again, pls =)

hmm I guess that you’re getting a RiError for some reason; this might
tell us
what’s happening:

diff -rN -u old-0.1/lib/fastri/ri_service.rb
new-0.1/lib/fastri/ri_service.rb
— old-0.1/lib/fastri/ri_service.rb 2006-11-11 23:13:38.000000000
+0100
+++ new-0.1/lib/fastri/ri_service.rb 2006-11-11 23:13:38.000000000
+0100
@@ -220,6 +220,8 @@
end
end
rescue RiError

  • puts “RiError: #{$!.message}”
  • puts $!.backtrace
    return nil
    end

Does fri --show-matches Array# return anything? (if it does, the
problem
lies in the processing of the descriptions, not in the lookup).
Also, you might want to take a look at the index (~/.fastri-index by
default)
to verify that it’s not empty (it’s a Marshal serialization but it’s
easy to
spot), or run
fastri-server -b
to rebuild the index and see if it found any methods/classes/modules:
$ fastri-server -b
Indexing RI docs for ParseTree version 1.5.0.
[…]
Indexing RI docs for tidy version 1.1.2.
Indexing RI docs for transaction-simple version 1.3.0.
Building index.
Indexed:

  • 11201 methods
  • 2304 classes/modules
    Needed 6.926496 seconds

also,
:~# 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:34136
-------------->^^^^^^^

How do i make the fastri fixed to a certain port, say 12345? we’re using
firewalls, so the concern…

I’ll implement this. Note that you’ll also have to open the port used by
the
Rinda Ring (7647).

cheers,

:fr Mauricio Julio Fernández Pradier

$ fri string.split

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

String#split

str.split(pattern=$;, [limit]) => anArray

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

----------

Divides str into substrings based on a delimiter, returning an

array of these substrings.

[…]

The less specific you are, the longer a lookup can take, but

fri’s slowest

search modes are still much faster than ri :slight_smile:

Here’s case-independent, nested, partial matching at work:

$ fri writer.rend

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

PDF::Writer#render

render(debug = false)

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

----------

Return the PDF stream as a string.

tried it on my win box, and yes! it works! very fast yet cool indeed.

btw, Mauricio, how do i troubleshoot the fri? is there a log somewhere?
I have a problem with one of my linux box running ubuntu6.10, ruby1.8.5,
gem0.9, and rails1.1.6. The install went fine, the fri server is
running, but when i query thru fri, eg fri String#upcase, the result
returns nil; in fact, all queries returns nil. tips again, pls =)

also,
:~# 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:34136
-------------->^^^^^^^

How do i make the fastri fixed to a certain port, say 12345? we’re using
firewalls, so the concern…

thanks and kind regards -botp

On Mon, Nov 13, 2006 at 01:13:36PM +0900, Peña, Botp wrote:

fastri-server -b

to rebuild the index and see if it found any methods/classes/modules:

yes, that was it. i was too dumb to not recreate it. this pc was a new
install and ri was just lately installed. sorry for me being too dumb.

It’s not your fault; it should have been created automatically when you
ran
fastri-server for the first time. Or did you already have an empty
.fastri-index?

i have another concern though.

[email protected]:/package# fri case
------------------------------------------------------ Multiple choices:
Regexp#casefold?, String#casecmp
[email protected]:/package#
[email protected]:/package# ri case
More than one method matched your request. You can refine
your search by asking for information on one of:
Symbol#camelcase, Symbol#downcase, Symbol#downcase?, Symbol#upcase,
[…]
String#lowercase?, String#upcase?, String#uppercase?,
Regexp#casefold?

which show that ri gets more hits. i think ri is using regex?

With FastRI, “partial matches” are of the form
/#{sep_re}#{name}/ for methods and
/^#{name}/ for namespaces (classes/modules)
(where sep_re is ‘#’, ‘.’ or ‘(#|.)’), so it only tries to complete
the
method and ‘#case’ matches Any::NameSpace::AnyClass#case.*, but not
.*case,
as it does in ri. It seems to me that method completion is more useful
normally.
If you want, I can add another search method (I don’t really know how to
name it
though), that behaves like ri. Note that fri will return the results
given by
the first successful method:

$ fri -h
[…]
-O, --order ORDER Specify lookup order.
(default: eEnNpPxX)
Uppercase: case-indep.
e: exact, n: nested, p: partial
x: nested and partial

So if I add the new “match anywhere” method at the end (say we call it
‘a’ and
‘A’ for the case-indep. variant, and then ‘b’/‘B’ for nested+“match
anywhere”),
doing -O eEnNpPxXaAbB you’ll still get
Regexp#casefold?, String#casecmp
because it will try partial matching (pP) first. So, in order for it to
behave
more like ri, you’d need -O eEnNxXaAbB.

> How do i make the fastri fixed to a certain port, say 12345? we’re using

> firewalls, so the concern…

I’ll implement this. Note that you’ll also have to open the # port used by

the # Rinda Ring (7647).

yes! thanks again.

It’s already in HEAD.

:fr Mauricio Julio Fernández Pradier

fastri-server -b

to rebuild the index and see if it found any methods/classes/modules:

$ fastri-server -b

Indexing RI docs for ParseTree version 1.5.0.

[…]

Indexing RI docs for tidy version 1.1.2.

Indexing RI docs for transaction-simple version 1.3.0.

Building index.

Indexed:

* 11201 methods

* 2304 classes/modules

Needed 6.926496 seconds

yes, that was it. i was too dumb to not recreate it. this pc was a new
install and ri was just lately installed. sorry for me being too dumb.

i have another concern though.

[email protected]:/package# fri case
------------------------------------------------------ Multiple choices:
Regexp#casefold?, String#casecmp
[email protected]:/package#
[email protected]:/package# ri case
More than one method matched your request. You can refine
your search by asking for information on one of:
Symbol#camelcase, Symbol#downcase, Symbol#downcase?, Symbol#upcase,
Symbol#upcase?, Symbol#camelcase, Symbol#downcase,
Symbol#downcase?, Symbol#upcase, Symbol#upcase?, String#casecmp,
String#downcase, String#downcase!, String#swapcase,
String#swapcase!, String#upcase, String#upcase!, String#camelcase,
String#downcase?, String#lowercase?, String#upcase?,
String#uppercase?, String#camelcase, String#downcase?,
String#lowercase?, String#upcase?, String#uppercase?,
Regexp#casefold?

which show that ri gets more hits. i think ri is using regex?

> How do i make the fastri fixed to a certain port, say

12345? we’re using

> firewalls, so the concern…

I’ll implement this. Note that you’ll also have to open the

port used by the

Rinda Ring (7647).

yes! thanks again.
kind regards -botp

cheers,

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs