Hi,

2010/7/3 Aaron Patterson <redmine / ruby-lang.org>:
> How about an alternative solution to this problem?  If someone does:
>
>    require 'somegem'
>
> The latest version of 'somegem' gets required.  If someone does this:
>
>    require 'rubygems'
>    require 'somegem'
>
> Then rubygems rules apply to subsequent gem requires.  The motivation beh=
ind this behavior comes from the idea that if someone doesn't require rubyg=
ems, then they don't want or care about rubygems version and activation rul=
es.  If the user *does* require rubygems, then we assume that they care abo=
ut such things.

This may be a new feature.  However, I don't object it because this
issue is actually a bug and we have no other solution (There will be
another solution theretically, but not in practice in the sense that
no one write a correct patch).

But,

> Attached is a patch that adds this behavior (originally written by Evan P=
hoenix).

Your patch is not correct, unfortunately.  make test-all does not run:


$ make test-all
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb
./tool/runruby.rb --extout=3D.ext  -- "./test/runner.rb"
/home/mame/work/ruby_1_9_2/lib/rubygems.rb:103: warning: already
initialized constant VERSION
/home/mame/work/ruby_1_9_2/lib/rubygems.rb:103: warning: already
initialized constant RubyGemsVersion
/home/mame/work/ruby_1_9_2/lib/rubygems.rb:147: warning: already
initialized constant MUTEX
/home/mame/work/ruby_1_9_2/lib/rubygems.rb:149: warning: already
initialized constant RubyGemsPackageVersion
/home/mame/work/ruby_1_9_2/lib/rubygems.rb:155: warning: already
initialized constant WIN_PATTERNS
/home/mame/work/ruby_1_9_2/lib/rubygems.rb:1018: warning: already
initialized constant MARSHAL_SPEC_DIR
/home/mame/work/ruby_1_9_2/lib/rubygems.rb:1023: warning: already
initialized constant YAML_SPEC_DIR
/home/mame/work/ruby_1_9_2/lib/rubygems.rb:613:in `path': undefined
method `default_path' for Gem:Module (NoMethodError)
        from /home/mame/work/ruby_1_9_2/lib/rubygems/source_index.rb:68:in
`installed_spec_directories'
        from /home/mame/work/ruby_1_9_2/lib/rubygems/source_index.rb:58:in
`from_installed_gems'
        from /home/mame/work/ruby_1_9_2/lib/rubygems.rb:861:in `source_inde=
x'
        from /home/mame/work/ruby_1_9_2/lib/rubygems/gem_path_searcher.rb:8=
1:in
`init_gemspecs'
        from /home/mame/work/ruby_1_9_2/lib/rubygems/gem_path_searcher.rb:1=
3:in
`initialize'
        from /home/mame/work/ruby_1_9_2/lib/rubygems.rb:819:in `new'
        from /home/mame/work/ruby_1_9_2/lib/rubygems.rb:819:in `block
in searcher'
        from <internal:prelude>:10:in `synchronize'
        from /home/mame/work/ruby_1_9_2/lib/rubygems.rb:818:in `searcher'
        from /home/mame/work/ruby_1_9_2/lib/rubygems.rb:479:in `find_files'
        from /home/mame/work/ruby_1_9_2/lib/rubygems.rb:961:in `load_plugin=
s'
        from /home/mame/work/ruby_1_9_2/lib/rubygems.rb:1118:in `<top
(required)>'
        from /home/mame/work/ruby_1_9_2/lib/rubygems/custom_require.rb:31:i=
n
`require'
        from /home/mame/work/ruby_1_9_2/lib/rubygems/custom_require.rb:31:i=
n
`require'
        from <internal:gem_prelude>:158:in `load_full_rubygems_library'
        from /home/mame/work/ruby_1_9_2/test/rubygems/gemutilities.rb:6:in
`<top (required)>'
        from /home/mame/work/ruby_1_9_2/test/rubygems/test_gem_dependency_i=
nstaller.rb:1:in
`require_relative'
        from /home/mame/work/ruby_1_9_2/test/rubygems/test_gem_dependency_i=
nstaller.rb:1:in
`<top (required)>'
        from /home/mame/work/ruby_1_9_2/lib/rubygems/custom_require.rb:31:i=
n
`require'
        from /home/mame/work/ruby_1_9_2/lib/rubygems/custom_require.rb:31:i=
n
`require'
        from /home/mame/work/ruby_1_9_2/lib/test/unit.rb:55:in `block
in setup_argv'
        from /home/mame/work/ruby_1_9_2/lib/test/unit.rb:49:in `each'
        from /home/mame/work/ruby_1_9_2/lib/test/unit.rb:49:in `setup_argv'
        from ./test/runner.rb:9:in `<main>'
make: *** [yes-test-all] Error 1

--=20
Yusuke Endoh <mame / tsg.ne.jp>