nakahiro at sarion.co.jp
Fri Nov 2 08:00:59 EDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
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
>>> 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
>>> 3. the dependency resolution of rubygems should be depth first search
>>> (the latest has a priority) with no backtrack I think. is this a
>> 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
>> 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"'
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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Rubygems-developers