diff options
Diffstat (limited to 'lib/rubygems/resolver/specification.rb')
| -rw-r--r-- | lib/rubygems/resolver/specification.rb | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/lib/rubygems/resolver/specification.rb b/lib/rubygems/resolver/specification.rb index 44989d39ae..d2098ef0e2 100644 --- a/lib/rubygems/resolver/specification.rb +++ b/lib/rubygems/resolver/specification.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true + ## # A Resolver::Specification contains a subset of the information # contained in a Gem::Specification. Only the information necessary for # dependency resolution in the resolver is included. class Gem::Resolver::Specification - ## # The dependencies of the gem for this specification @@ -45,6 +45,16 @@ class Gem::Resolver::Specification attr_reader :version ## + # The required_ruby_version constraint for this specification. + + attr_reader :required_ruby_version + + ## + # The required_ruby_version constraint for this specification. + + attr_reader :required_rubygems_version + + ## # Sets default instance variables for the specification. def initialize @@ -54,6 +64,8 @@ class Gem::Resolver::Specification @set = nil @source = nil @version = nil + @required_ruby_version = Gem::Requirement.default + @required_rubygems_version = Gem::Requirement.default end ## @@ -81,14 +93,10 @@ class Gem::Resolver::Specification # After installation #spec is updated to point to the just-installed # specification. - def install options = {} - require 'rubygems/installer' + def install(options = {}) + require_relative "../installer" - destination = options[:install_dir] || Gem.dir - - Gem.ensure_gem_subdirectories destination - - gem = source.download spec, destination + gem = download options installer = Gem::Installer.at gem, options @@ -97,15 +105,22 @@ class Gem::Resolver::Specification @spec = installer.install end + def download(options) + dir = options[:install_dir] || Gem.dir + + Gem.ensure_gem_subdirectories dir + + source.download spec, dir + end + ## # Returns true if this specification is installable on this platform. def installable_platform? - Gem::Platform.match spec.platform + Gem::Platform.match_spec? spec end def local? # :nodoc: false end end - |
