lib/rubygems/request_set.rb in rubygems-update-2.3.0 vs lib/rubygems/request_set.rb in rubygems-update-2.4.0

- old
+ new

@@ -80,10 +80,11 @@ def initialize *deps @dependencies = deps @always_install = [] + @conservative = false @dependency_names = {} @development = false @development_shallow = false @errors = [] @git_set = nil @@ -189,19 +190,20 @@ def install_from_gemdeps options, &block gemdeps = options[:gemdeps] @install_dir = options[:install_dir] || Gem.dir @remote = options[:domain] != :local + @conservative = true if options[:conservative] - gem_deps_api = load_gemdeps gemdeps, options[:without_groups] + gem_deps_api = load_gemdeps gemdeps, options[:without_groups], true resolve if options[:explain] puts "Gems to install:" - specs.sorted_requests.each do |spec| + sorted_requests.each do |spec| puts " #{spec.full_name}" end if Gem.configuration.really_verbose @resolver.stats.display @@ -254,20 +256,21 @@ end ## # Load a dependency management file. - def load_gemdeps path, without_groups = [] + def load_gemdeps path, without_groups = [], installing = false @git_set = Gem::Resolver::GitSet.new @vendor_set = Gem::Resolver::VendorSet.new @git_set.root_dir = @install_dir lockfile = Gem::RequestSet::Lockfile.new self, path lockfile.parse gf = Gem::RequestSet::GemDependencyAPI.new self, path + gf.installing = installing gf.without_groups = without_groups if without_groups gf.load end ## @@ -285,9 +288,17 @@ resolver = Gem::Resolver.new @dependencies, set resolver.development = @development resolver.development_shallow = @development_shallow resolver.ignore_dependencies = @ignore_dependencies resolver.soft_missing = @soft_missing + + if @conservative + installed_gems = {} + Gem::Specification.find_all do |spec| + (installed_gems[spec.name] ||= []) << spec + end + resolver.skip_gems = installed_gems + end @resolver = resolver @requests = resolver.resolve