summaryrefslogtreecommitdiff
path: root/lib/rubygems/core_ext/kernel_require.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/core_ext/kernel_require.rb')
-rwxr-xr-xlib/rubygems/core_ext/kernel_require.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index 014090a..89e3e33 100755
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -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].each do |lp|
+ Gem.suffixes.each do |s|
+ full_path = File.join(lp, "#{path}#{s}")
+ if File.file?(File.expand_path(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)
Gem.remove_unresolved_default_spec(spec)
begin