diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-14 03:30:02 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-14 03:30:02 +0000 |
commit | 4de117a61517e839f2c45eaf45d56fc243d6d5b2 (patch) | |
tree | 7cb5af7a7eb513e5dddf5e343746b1611e628387 /lib/rubygems/core_ext | |
parent | e548c09d429a5136285ea81aed418685359ed124 (diff) | |
download | ruby-4de117a61517e839f2c45eaf45d56fc243d6d5b2.tar.gz |
* lib/rubygems: Update to RubyGems 2.4.1 master(713ab65)
Complete history at:
https://github.com/rubygems/rubygems/blob/master/History.txt#L3-L216
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/core_ext')
-rw-r--r-- | lib/rubygems/core_ext/kernel_gem.rb | 9 | ||||
-rwxr-xr-x | lib/rubygems/core_ext/kernel_require.rb | 34 |
2 files changed, 20 insertions, 23 deletions
diff --git a/lib/rubygems/core_ext/kernel_gem.rb b/lib/rubygems/core_ext/kernel_gem.rb index 3405233ab1..edce4ee10b 100644 --- a/lib/rubygems/core_ext/kernel_gem.rb +++ b/lib/rubygems/core_ext/kernel_gem.rb @@ -26,6 +26,11 @@ module Kernel # Kernel#gem should be called *before* any require statements (otherwise # RubyGems may load a conflicting library version). # + # Kernel#gem only loads prerelease versions when prerelease +requirements+ + # are given: + # + # gem 'rake', '>= 1.1.a', '< 2' + # # In older RubyGems versions, the environment variable GEM_SKIP could be # used to skip activation of specified gems, for example to test out changes # that haven't been installed yet. Now RubyGems defers to -I and the @@ -51,7 +56,9 @@ module Kernel end spec = Gem::Dependency.new(gem_name, *requirements).to_spec - spec.activate if spec + Gem::LOADED_SPECS_MUTEX.synchronize { + spec.activate + } if spec end private :gem diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb index 84bb03f67d..bf9618d3bf 100755 --- a/lib/rubygems/core_ext/kernel_require.rb +++ b/lib/rubygems/core_ext/kernel_require.rb @@ -50,12 +50,8 @@ module Kernel # normal require handle loading a gem from the rescue below. if Gem::Specification.unresolved_deps.empty? then - begin - RUBYGEMS_ACTIVATION_MONITOR.exit - return gem_original_require(path) - ensure - RUBYGEMS_ACTIVATION_MONITOR.enter - end + RUBYGEMS_ACTIVATION_MONITOR.exit + return gem_original_require(path) end # If +path+ is for a gem that has already been loaded, don't @@ -71,8 +67,6 @@ module Kernel begin RUBYGEMS_ACTIVATION_MONITOR.exit return gem_original_require(path) - ensure - RUBYGEMS_ACTIVATION_MONITOR.enter end if spec # Attempt to find +path+ in any unresolved gems... @@ -105,6 +99,7 @@ module Kernel names = found_specs.map(&:name).uniq if names.size > 1 then + RUBYGEMS_ACTIVATION_MONITOR.exit raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ', '}" end @@ -115,32 +110,27 @@ module Kernel unless valid then le = Gem::LoadError.new "unable to find a version of '#{names.first}' to activate" le.name = names.first + RUBYGEMS_ACTIVATION_MONITOR.exit raise le end valid.activate end - begin - RUBYGEMS_ACTIVATION_MONITOR.exit - return gem_original_require(path) - ensure - RUBYGEMS_ACTIVATION_MONITOR.enter - end + RUBYGEMS_ACTIVATION_MONITOR.exit + return gem_original_require(path) rescue LoadError => load_error + RUBYGEMS_ACTIVATION_MONITOR.enter + if load_error.message.start_with?("Could not find") or (load_error.message.end_with?(path) and Gem.try_activate(path)) then - begin - RUBYGEMS_ACTIVATION_MONITOR.exit - return gem_original_require(path) - ensure - RUBYGEMS_ACTIVATION_MONITOR.enter - end + RUBYGEMS_ACTIVATION_MONITOR.exit + return gem_original_require(path) + else + RUBYGEMS_ACTIVATION_MONITOR.exit end raise load_error - ensure - RUBYGEMS_ACTIVATION_MONITOR.exit end private :require |