[Rubygems-developers] Specifying where to install the stub file

Jim Weirich jim at weirichhouse.org
Mon Jul 12 13:44:13 EDT 2004

Chad Fowler said:
> On Mon, 12 Jul 2004, Michael Neumann wrote:
> # Now I'd like to install the stub not as 'Pg.rb' but as 'DBD/Pg/Pg.rb'.
> #
> # Is there a way to do this?
> #
> Right now the only way I know of to do this is for your gem to actually
> contain the file with path DBD/Pg/Pg.rb and for your autorequire to be
> 'DBD/Pg/Pg'.
> Since Pg would be your autorequire, the end user wouldn't actually have to
> ever require 'DBD/Pg/Pg' in this case.
> Does that make sense?

I'm not sure that will help Michael's situation.

The end user never explicitly requires the database driver (eg. Pg.rb). 
The DBI software will load it based on the connection string given to the
DBI connection method (e.g.  "DBI:Pg:databasename" tells DBI to find and
load the Pg database driver).

Michael, how do you feel about adding some gem specific logic to DBI?  It
can be done is such a way that if rubygems is not available, then the
logic never triggers; but if rubygems is available, then we can search the
gem-space as well.

I'm not generally in favor of embedding gem-specific behavior in general
purpose code, but software that explicitly searches the load path interact
in interesting ways with rubygem's approach to managing the loadpath.

I'd be glad to help with any gem-specific code.  What are your thoughts?

-- Jim Weirich     jim at weirichhouse.org    http://onestepback.org
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

More information about the Rubygems-developers mailing list