lib/rubygems/resolver.rb in rubygems-update-2.7.11 vs lib/rubygems/resolver.rb in rubygems-update-3.0.0
- old
+ new
@@ -57,11 +57,11 @@
##
# Combines +sets+ into a ComposedSet that allows specification lookup in a
# uniform manner. If one of the +sets+ is itself a ComposedSet its sets are
# flattened into the result ComposedSet.
- def self.compose_sets *sets
+ def self.compose_sets(*sets)
sets.compact!
sets = sets.map do |set|
case set
when Gem::Resolver::BestSet then
@@ -85,11 +85,11 @@
##
# Creates a Resolver that queries only against the already installed gems
# for the +needed+ dependencies.
- def self.for_current_gems needed
+ def self.for_current_gems(needed)
new needed, Gem::Resolver::CurrentSet.new
end
##
# Create Resolver object which will resolve the tree starting
@@ -97,11 +97,11 @@
#
# +set+ is an object that provides where to look for specifications to
# satisfy the Dependencies. This defaults to IndexSet, which will query
# rubygems.org.
- def initialize needed, set = nil
+ def initialize(needed, set = nil)
@set = set || Gem::Resolver::IndexSet.new
@needed = needed
@development = false
@development_shallow = false
@@ -110,18 +110,18 @@
@skip_gems = {}
@soft_missing = false
@stats = Gem::Resolver::Stats.new
end
- def explain stage, *data # :nodoc:
+ def explain(stage, *data) # :nodoc:
return unless DEBUG_RESOLVER
d = data.map { |x| x.pretty_inspect }.join(", ")
$stderr.printf "%10s %s\n", stage.to_s.upcase, d
end
- def explain_list stage # :nodoc:
+ def explain_list(stage) # :nodoc:
return unless DEBUG_RESOLVER
data = yield
$stderr.printf "%10s (%d entries)\n", stage.to_s.upcase, data.size
PP.pp data, $stderr unless data.empty?
@@ -131,11 +131,11 @@
# Creates an ActivationRequest for the given +dep+ and the last +possible+
# specification.
#
# Returns the Specification and the ActivationRequest
- def activation_request dep, possible # :nodoc:
+ def activation_request(dep, possible) # :nodoc:
spec = possible.pop
explain :activate, [spec.full_name, possible.size]
explain :possible, possible
@@ -143,11 +143,11 @@
Gem::Resolver::ActivationRequest.new spec, dep, possible
return spec, activation_request
end
- def requests s, act, reqs=[] # :nodoc:
+ def requests(s, act, reqs=[]) # :nodoc:
return reqs if @ignore_dependencies
s.fetch_development_dependencies if @development
s.dependencies.reverse_each do |d|
@@ -169,11 +169,11 @@
end
include Molinillo::UI
def output
- @output ||= debug? ? $stdout : File.open(Gem::Util::NULL_DEVICE, 'w')
+ @output ||= debug? ? $stdout : File.open(IO::NULL, 'w')
end
def debug?
DEBUG_RESOLVER
end
@@ -195,11 +195,11 @@
##
# Extracts the specifications that may be able to fulfill +dependency+ and
# returns those that match the local platform and all those that match.
- def find_possible dependency # :nodoc:
+ def find_possible(dependency) # :nodoc:
all = @set.find_all dependency
if (skip_dep_gems = skip_gems[dependency.name]) && !skip_dep_gems.empty?
matching = all.select do |api_spec|
skip_dep_gems.any? { |s| api_spec.version == s.version }
@@ -214,11 +214,11 @@
end
##
# Returns the gems in +specs+ that match the local platform.
- def select_local_platforms specs # :nodoc:
+ def select_local_platforms(specs) # :nodoc:
specs.select do |spec|
Gem::Platform.installable? spec
end
end
@@ -311,14 +311,9 @@
end
end
private :amount_constrained
end
-
-##
-# TODO remove in RubyGems 3
-
-Gem::DependencyResolver = Gem::Resolver # :nodoc:
require 'rubygems/resolver/activation_request'
require 'rubygems/resolver/conflict'
require 'rubygems/resolver/dependency_request'
require 'rubygems/resolver/requirement_list'