lib/rubygems/request_set.rb in rubygems-update-2.4.1 vs lib/rubygems/request_set.rb in rubygems-update-2.4.2

- old
+ new

@@ -45,11 +45,18 @@ # When true, dependency resolution is not performed, only the requested gems # are installed. attr_accessor :ignore_dependencies + attr_reader :install_dir # :nodoc: + ## + # If true, allow dependencies to match prerelease gems. + + attr_accessor :prerelease + + ## # When false no remote sets are used for resolving gems. attr_accessor :remote attr_reader :resolver # :nodoc: @@ -88,10 +95,11 @@ @development_shallow = false @errors = [] @git_set = nil @ignore_dependencies = false @install_dir = Gem.dir + @prerelease = false @remote = true @requests = [] @sets = [] @soft_missing = false @sorted = nil @@ -133,10 +141,11 @@ requests = install_into dir, false, options, &block return requests end cache_dir = options[:cache_dir] || Gem.dir + @prerelease = options[:prerelease] requests = [] sorted_requests.each do |req| if req.installed? then @@ -189,10 +198,11 @@ def install_from_gemdeps options, &block gemdeps = options[:gemdeps] @install_dir = options[:install_dir] || Gem.dir + @prerelease = options[:prerelease] @remote = options[:domain] != :local @conservative = true if options[:conservative] gem_deps_api = load_gemdeps gemdeps, options[:without_groups], true @@ -232,10 +242,11 @@ installed = [] options[:development] = false options[:install_dir] = dir options[:only_install_dir] = true + @prerelease = options[:prerelease] sorted_requests.each do |request| spec = request.spec if existing.find { |s| s.full_name == spec.full_name } then @@ -271,10 +282,52 @@ gf.installing = installing gf.without_groups = without_groups if without_groups gf.load end + def pretty_print q # :nodoc: + q.group 2, '[RequestSet:', ']' do + q.breakable + + if @remote then + q.text 'remote' + q.breakable + end + + if @prerelease then + q.text 'prerelease' + q.breakable + end + + if @development_shallow then + q.text 'shallow development' + q.breakable + elsif @development then + q.text 'development' + q.breakable + end + + if @soft_missing then + q.text 'soft missing' + end + + q.group 2, '[dependencies:', ']' do + q.breakable + @dependencies.map do |dep| + q.text dep.to_s + q.breakable + end + end + + q.breakable + q.text 'sets:' + + q.breakable + q.pp @sets.map { |set| set.class } + end + end + ## # Resolve the requested dependencies and return an Array of Specification # objects to be activated. def resolve set = Gem::Resolver::BestSet.new @@ -282,10 +335,11 @@ @sets << @git_set @sets << @vendor_set set = Gem::Resolver.compose_sets(*@sets) set.remote = @remote + set.prerelease = @prerelease resolver = Gem::Resolver.new @dependencies, set resolver.development = @development resolver.development_shallow = @development_shallow resolver.ignore_dependencies = @ignore_dependencies @@ -336,10 +390,12 @@ def tsort_each_child node # :nodoc: node.spec.dependencies.each do |dep| next if dep.type == :development and not @development - match = @requests.find { |r| dep.match? r.spec.name, r.spec.version } + match = @requests.find { |r| + dep.match? r.spec.name, r.spec.version, @prerelease + } unless match then next if dep.type == :development and @development_shallow next if @soft_missing raise Gem::DependencyError,