[Xapian-devel] Ruby bindings now pass all smoketests

Paul Legato plegato at nks.net
Sat Apr 22 19:05:06 BST 2006


Olly Betts wrote:
> The Makefile.am patch got applied to the wrong Makefile.am, and
> my configure test was broken.  Also, now there's a xapian.rb we need
> to find out where to install that.

Ruby will load required files from a number of directories by default 
(it varies by distribution, but you can see the defaults on your system 
by running "puts $:" from within irb.) Users can also specify -I /path/ 
with their invocation of the Ruby interpreter to add paths, or they can 
give a full pathname to xapian.rb when they require it..

> 
> I've renamed the .so to _xapian.so because otherwise I don't see how
> xapian.rb can load xapian.so once both are installed, but perhaps I'm
> missing some subtlety (none of the Ruby modules installed on my dev-box
> have a .so and .rb with the same basename).  Or perhaps there's a
> Ruby convention for how to name the .so in this situation.
> 

I like the underscore idea, because it emphasizes to users that they 
shouldn't try to require the .so file directly, but should rather use 
xapian.rb. There is one problem -- Ruby tries to initialize shared 
objects by calling an Init_<objectname> function. So when I require 
_xapian, it tries to call Init__xapian, which doesn't exist.

I can't get the configure script to work here. It rejects my version of 
SWIG (1.3.29 is not yet available in Debian Unstable). So, this issue 
may well be fixed when building the correct way. :) I've renamed things 
in rebuild.sh to use the underscore when generating, but it still 
doesn't work. For now, I will change it to "require 'xapian.so'" 
explicitly (since Ruby is not smart enough to not try to include 
xapian.rb from within itself.)

> Anyway, here's a patch:

Now committed to SVN. Thanks!


> It'd be good to have Ruby versions of simpleindex and simplesearch
> which would provide a more real world test, and serve as good examples
> (the other bindings all have versions).

Sounds good. I will get some examples going.

Best,
Paul

-- 

--------------------------------------------------
--    Paul Legato, Senior Software Engineer     --
---       Networked Knowledge Systems          ---
----   P.O. Box 20772 Tampa, FL. 33622-0772   ----
----- (813)594-0064 Voice  (813)594-0045 FAX -----
------           plegato at nks.net            ------
--------------------------------------------------


--------------------------------------------------
-----   This email bound by the following:   -----
---- http://www.nks.net/email_disclaimer.html ----
--------------------------------------------------




More information about the Xapian-devel mailing list