[Rubygems-developers] library stub again
rich at infoether.com
Thu Jun 10 14:33:16 EDT 2004
On 6/10/04 2:23 PM, "Ryan Leavengood" <mrcode1234 at yahoo.com> wrote:
> --- Pierre Baillet <oct at zoy.org> wrote:
>> I was wondering if there couldn't be some way (I don't have the answer,
>> that's why I'm asking, of course) to override the kernel require with
>> some special rubygem require so as to make the gems work on unmodified
>> application code... ?
> I did this in my original RubyGems prototype a few years ago. It is not
> particularly difficult. In fact part of my presentation at RubyConf 2001
> involved running a script that uses a gem normally (which causes an error) and
> then with "-r rubygems" on the Ruby command-line to show how require was
> To the rest of the "new" RubyGems developers: why wasn't this done in your
It has been done, in several ways. One was to replace the 'require'
statement. Like you said, this is easy, and its been proposed (see 'require
hack' in previous posts). The alternative, that we opted for instead, was
to create a 'stub' file in the site_ruby directory for each gem (see
--install-stub ...which is the default now, I think). That stub does the
requiring of rubygems, and require_gem of the gem itself so you can just do
'require'. But that does not override the existing require statement.
When RubyGems reaches 1.0, and Matz agrees to get it in the distro, then,
perhaps, we can modify the _REAL_ require source (in C) to do rubygems
transparently. We don't really want to bug him before that.
More information about the Rubygems-developers