[Rubygems-developers] gemloader.rb

Eric Hodel drbrain at segment7.net
Thu Nov 1 23:55:52 EDT 2007

On Oct 21, 2007, at 18:06 , NAKAMURA, Hiroshi wrote:
> NAKAMURA, Hiroshi wrote:
>> At the last, I have some questions about rubygems.
>> 1. can rubygems/requirement.rb and rubygems/version.rb be free from
>>    require 'rubygems'?

They are needed for 3.

>> 2. Kernel.require of rubygems tries to reload the original feature  
>> when
>>    the original require failed.  not failed feature but the  
>> original, is
>>    this intended?

This is fixed in latest RubyGems.  If the LoadError file does not  
match the original feature, the exception is re-raised immediately.

>> 3. the dependency resolution of rubygems should be depth first search
>>    (the latest has a priority) with no backtrack I think.  is this a
>>    specification?


> 4. rubygems adds spec.bindir to $LOAD_PATH when a gem is activated.
> Can't it be a problem when 2 files in bindir and libdir have the same
> name?  I know it's needed for gem wrapper for a bin script and the  
> file
> in bindir won't be activated by require.

require will always try 'foo.rb' or similar, bin path files are  
loaded with #load, instead.  It is a cheap trick.

$ echo 'puts "foo"' > foo
$ echo 'puts "foo.rb"' > foo.rb
$ ruby -rfoo -e0
$ ruby -e 'load "foo"'

Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars

More information about the Rubygems-developers mailing list