diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-13 01:40:42 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-13 01:40:42 +0000 |
commit | fdb6a621b0bde5dec6b4541569a95fb2f16261a3 (patch) | |
tree | c9e5506f6f6cc62d33bb90c9b1b933e374c68d4e /lib | |
parent | e6a317bf6c4f988fe005af271c1d40ddc9c1ae59 (diff) | |
download | ruby-fdb6a621b0bde5dec6b4541569a95fb2f16261a3.tar.gz |
* lib/rubygems: Update to RubyGems 2.1.3
Fixed installing platform gems
Restored concurrent requires
Fixed installing gems with extensions with --install-dir
Fixed `gem fetch -v` to install the latest version
Fixed installing gems with "./" in their files entries
* test/rubygems/test_gem_package.rb: Tests for the above.
* NEWS: Updated for RubyGems 2.1.3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/fetch_command.rb | 6 | ||||
-rwxr-xr-x | lib/rubygems/core_ext/kernel_require.rb | 28 | ||||
-rw-r--r-- | lib/rubygems/dependency_resolver.rb | 12 | ||||
-rw-r--r-- | lib/rubygems/dependency_resolver/index_specification.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/installer.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/package.rb | 8 |
7 files changed, 49 insertions, 13 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 51252e4773..fac38e4143 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -8,7 +8,7 @@ require 'rbconfig' module Gem - VERSION = '2.1.0' + VERSION = '2.1.3' end # Must be first since it unloads the prelude from 1.9.2 diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb index b35987c329..c57ab0089a 100644 --- a/lib/rubygems/commands/fetch_command.rb +++ b/lib/rubygems/commands/fetch_command.rb @@ -52,13 +52,15 @@ then repackaging it. dep = Gem::Dependency.new gem_name, version dep.prerelease = options[:prerelease] - specs_and_sources, errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep + specs_and_sources, errors = + Gem::SpecFetcher.fetcher.spec_for_dependency dep + if platform then filtered = specs_and_sources.select { |s,| s.platform == platform } specs_and_sources = filtered unless filtered.empty? end - spec, source = specs_and_sources.sort_by { |s,| s.version }.first + spec, source = specs_and_sources.max_by { |s,| s.version } if spec.nil? then show_lookup_failure gem_name, version, errors, options[:domain] diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb index 3619f3f559..0416644920 100755 --- a/lib/rubygems/core_ext/kernel_require.rb +++ b/lib/rubygems/core_ext/kernel_require.rb @@ -48,7 +48,12 @@ module Kernel # normal require handle loading a gem from the rescue below. if Gem::Specification.unresolved_deps.empty? then - return gem_original_require(path) + begin + RUBYGEMS_ACTIVATION_MONITOR.exit + return gem_original_require(path) + ensure + RUBYGEMS_ACTIVATION_MONITOR.enter + end end # If +path+ is for a gem that has already been loaded, don't @@ -61,7 +66,12 @@ module Kernel s.activated? and s.contains_requirable_file? path } - return gem_original_require(path) if spec + 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... @@ -109,11 +119,21 @@ module Kernel valid.activate end - gem_original_require path + begin + RUBYGEMS_ACTIVATION_MONITOR.exit + return gem_original_require(path) + ensure + RUBYGEMS_ACTIVATION_MONITOR.enter + end rescue LoadError => load_error if load_error.message.start_with?("Could not find") or (load_error.message.end_with?(path) and Gem.try_activate(path)) then - return gem_original_require(path) + begin + RUBYGEMS_ACTIVATION_MONITOR.exit + return gem_original_require(path) + ensure + RUBYGEMS_ACTIVATION_MONITOR.enter + end end raise load_error diff --git a/lib/rubygems/dependency_resolver.rb b/lib/rubygems/dependency_resolver.rb index 721fd43c51..abce692920 100644 --- a/lib/rubygems/dependency_resolver.rb +++ b/lib/rubygems/dependency_resolver.rb @@ -131,8 +131,9 @@ class Gem::DependencyResolver return conflict end - # Get a list of all specs that satisfy dep + # Get a list of all specs that satisfy dep and platform possible = @set.find_all dep + possible = select_local_platforms possible case possible.size when 0 @@ -228,6 +229,15 @@ class Gem::DependencyResolver specs end + ## + # Returns the gems in +specs+ that match the local platform. + + def select_local_platforms specs # :nodoc: + specs.select do |spec| + Gem::Platform.match spec.platform + end + end + end require 'rubygems/dependency_resolver/api_set' diff --git a/lib/rubygems/dependency_resolver/index_specification.rb b/lib/rubygems/dependency_resolver/index_specification.rb index d8ac69d402..fc409334e8 100644 --- a/lib/rubygems/dependency_resolver/index_specification.rb +++ b/lib/rubygems/dependency_resolver/index_specification.rb @@ -43,7 +43,7 @@ class Gem::DependencyResolver::IndexSpecification unless Gem::Platform::RUBY == @platform then q.breakable - q.text @platform + q.text @platform.to_s end q.breakable diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 49ad7dfae5..261af890c8 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -213,6 +213,8 @@ class Gem::Installer FileUtils.mkdir_p gem_dir + spec.loaded_from = spec_file + if @options[:install_as_default] extract_bin write_default_spec @@ -230,8 +232,6 @@ class Gem::Installer say spec.post_install_message unless spec.post_install_message.nil? - spec.loaded_from = spec_file - Gem::Specification.add_spec spec unless Gem::Specification.include? spec run_post_install_hooks diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb index 65db3f8e2e..ba379c24cb 100644 --- a/lib/rubygems/package.rb +++ b/lib/rubygems/package.rb @@ -339,9 +339,13 @@ EOM def extract_tar_gz io, destination_dir, pattern = "*" # :nodoc: open_tar_gz io do |tar| tar.each do |entry| - next unless File.fnmatch pattern, entry.full_name + # Some entries start with "./" which fnmatch does not like, see github + # issue #644 + full_name = entry.full_name.sub %r%\A\./%, '' - destination = install_location entry.full_name, destination_dir + next unless File.fnmatch pattern, full_name + + destination = install_location full_name, destination_dir FileUtils.rm_rf destination |