1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/purelib.rb
yugui 618cb2cab0 * ext/purelib.rb: translates a fake path to rubygems in $" into
an alternative in $: so that Kernel.#require does not load
  more rubygems.rb.
  Resolves many failures in test/rubygems/*.

* gem_prelude.rb (Gem.load_full_rubygems_library): supports case 
  the rubygems to load is not in $(rubylibprefix).
  (Gem.path_to_full_rubygems_library): new method for the changes in
  purelib.rb and Gem.load_full_rubygems_library.
  (Gem.fake_rubygems_as_loaded): new method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-15 09:05:32 +00:00

17 lines
441 B
Ruby

nul = nil
$:.each_with_index {|path, index|
if /\A(?:\.\/)*-\z/ =~ path
nul = index
break
end
}
if nul
removed, $:[nul..-1] = $:[nul..-1], ["."]
if defined?(Gem::QuickLoader)
removed.each do |path|
# replaces a fake rubygems by gem_prelude.rb with an alternative path
index = $".index(File.join(path, 'rubygems.rb'))
$"[index] = Gem::QuickLoader.path_to_full_rubygems_library if index
end
end
end