diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-20 00:31:12 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-20 00:31:12 +0000 |
commit | 8552f7aa680e1f1a31d76dc9038d80248a445960 (patch) | |
tree | 29de125ca8389a65e44d42b269a19274b8846b11 /lib/rubygems/specification.rb | |
parent | 347e748bddd42e5a39dcb5c55ac37704a14b9374 (diff) |
* lib/rubygems: Update to RubyGems master 3de7e0f. Changes:
Only attempt to build extensions for newly-installed gems. This
prevents compilation attempts at gem activation time for gems that
already have extensions built.
Fix crash in the dependency resolver for dependencies that cannot be
resolved.
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/specification.rb')
-rw-r--r-- | lib/rubygems/specification.rb | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 21119b901a..b2c2acc294 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -506,6 +506,23 @@ class Gem::Specification < Gem::BasicSpecification end ## + # The version of RubyGems that installed this gem. Returns + # <code>Gem::Version.new(0)</code> for gems installed by versions earlier + # than RubyGems 2.2.0. + + def installed_by_version # :nodoc: + @installed_by_version ||= Gem::Version.new(0) + end + + ## + # Sets the version of RubyGems that installed this gem. See also + # #installed_by_version. + + def installed_by_version= version # :nodoc: + @installed_by_version = Gem::Version.new version + end + + ## # The license for this gem. # # The license must be a short name, no more than 64 characters. @@ -1391,6 +1408,7 @@ class Gem::Specification < Gem::BasicSpecification def build_extensions # :nodoc: return if default_gem? return if extensions.empty? + return if installed_by_version < Gem::Version.new('2.2') return if File.exist? gem_build_complete_path return if !File.writable?(base_dir) && !File.exist?(File.join(base_dir, 'extensions')) @@ -1776,6 +1794,7 @@ class Gem::Specification < Gem::BasicSpecification @activated = false self.loaded_from = nil @original_platform = nil + @installed_by_version = nil @@nil_attributes.each do |key| instance_variable_set "@#{key}", nil @@ -1979,7 +1998,12 @@ class Gem::Specification < Gem::BasicSpecification q.group 2, 'Gem::Specification.new do |s|', 'end' do q.breakable - @@attributes.each do |attr_name| + attributes = @@attributes - [:name, :version] + attributes.unshift :installed_by_version + attributes.unshift :version + attributes.unshift :name + + attributes.each do |attr_name| current_value = self.send attr_name if current_value != default_value(attr_name) or self.class.required_attribute? attr_name then @@ -2262,6 +2286,11 @@ class Gem::Specification < Gem::BasicSpecification end end + if @installed_by_version then + result << nil + result << " s.installed_by_version = \"#{Gem::VERSION}\"" + end + unless dependencies.empty? then result << nil result << " if s.respond_to? :specification_version then" |