mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00
Revert "Revert "[rubygems/rubygems] [Require] Ensure -I beats a default gem""
This reverts commit 75d29db8f9
.
This commit is contained in:
parent
9d20d2b0f5
commit
dd16f8524c
3 changed files with 54 additions and 0 deletions
|
@ -36,6 +36,26 @@ module Kernel
|
|||
|
||||
path = path.to_path if path.respond_to? :to_path
|
||||
|
||||
resolved_path = begin
|
||||
rp = nil
|
||||
$LOAD_PATH[0...Gem.load_path_insert_index || -1].each do |lp|
|
||||
Gem.suffixes.each do |s|
|
||||
full_path = File.expand_path(File.join(lp, "#{path}#{s}").untaint)
|
||||
if File.file?(full_path)
|
||||
rp = full_path
|
||||
break
|
||||
end
|
||||
end
|
||||
break if rp
|
||||
end
|
||||
rp
|
||||
end
|
||||
|
||||
if resolved_path
|
||||
RUBYGEMS_ACTIVATION_MONITOR.exit
|
||||
return gem_original_require(resolved_path)
|
||||
end
|
||||
|
||||
if spec = Gem.find_unresolved_default_spec(path)
|
||||
begin
|
||||
Kernel.send(:gem, spec.name, "#{Gem::Requirement.default}.a")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue