diff options
Diffstat (limited to 'lib/rubygems/custom_require.rb')
-rw-r--r-- | lib/rubygems/custom_require.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/rubygems/custom_require.rb b/lib/rubygems/custom_require.rb index eaa04b31c3..f32d1007c9 100644 --- a/lib/rubygems/custom_require.rb +++ b/lib/rubygems/custom_require.rb @@ -41,19 +41,20 @@ module Kernel if Gem.unresolved_deps.empty? or Gem.loaded_path? path then gem_original_require path else - spec = Gem.searcher.find_active path + spec = Gem::Specification.find { |s| + s.activated? and s.contains_requirable_file? path + } unless spec then - found_specs = Gem.searcher.find_in_unresolved path + found_specs = Gem::Specification.find_in_unresolved path unless found_specs.empty? then found_specs = [found_specs.last] else - found_specs = Gem.searcher.find_in_unresolved_tree path + found_specs = Gem::Specification.find_in_unresolved_tree path end found_specs.each do |found_spec| - # FIX: this is dumb, activate a spec instead of name/version - Gem.activate found_spec.name, found_spec.version + found_spec.activate end end |