[Rubygems-developers] gemloader.rb

NAKAMURA, Hiroshi nakahiro at sarion.co.jp
Fri Nov 2 08:00:59 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Eric Hodel wrote:
> 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.

Sure.  But they (requirement.rb and version.rb) does not need other
features, right?  I just mean version.rb.diff can be applied.  Third
party product may want to use Gem::Requirement and Gem::Version.

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

Sorry, I was not aware the change.

Hmm.  Isn't that a bit too strict?  Gem A depends to Gem B, but the
author of Gem A accidently removed a dependency to Gem B from its
gemspec.  Now users get a LoadError even though they actually have a Gem
B.  Right?

>>> 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?
> 
> Yes.

Thanks.

>> 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
> foo.rb
> $ ruby -e 'load "foo"'
> foo

But if there're bin/foo.rb in bindir and lib/foo.rb in require_path?
Gem wrapper surely loads foo.rb in bindir because spec.bindir is
unshifted to $LOAD_PATH.  But 'require "foo"' in a program loads
'foo.rb' in bindir I think.  Correct me if I misunderstand something.

Regards,
// NaHi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRysReR9L2jg5EEGlAQKj/AgAgI+HQmz3dDn6yVaE8Bu+Z1UQNXk5VYpr
8WtvdXlFshvfnFW8B2YHjP5/ZyoCvbEN9qMIpewwwRWZmMMqOFEX4oiLQ7K6BbEu
p5DICA9rb7eYxtK/x7W7L6Dwp15kc6sq7t0e0mrerF4GUSDwPoU+wHszpMPkaJ3a
GLuhrcxT+0nR+eyY9jcF5536srBy6wLbCABqfbd5gjOcZGF5z2nbzlHvb/D76Ah3
+hhZ+mKK5v52fl0fpNunplrLRCrEYHXEHmwoIsiHulxymdgZXfsj0ErI/S2oBylA
oGnXGwCm6GXkVB+8Q7WrljCRDbajNVvTQ6hjER5GxfE5izanZSaL/A==
=sgUb
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: version.rb.diff
Url: http://rubyforge.org/pipermail/rubygems-developers/attachments/20071102/cb648a17/attachment.pl 


More information about the Rubygems-developers mailing list