summaryrefslogtreecommitdiff
path: root/lib/rubygems/resolver
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-21 10:20:47 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-21 10:20:47 +0000
commit5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 (patch)
treec63321cb7c7c5c15454a79d81123c7188be2c51e /lib/rubygems/resolver
parent2f023c5dbaadede9ceac3eb9ac0e73f3050e5ada (diff)
Merge master branch from rubygems/rubygems upstream.
* Enable Style/MethodDefParentheses in Rubocop https://github.com/rubygems/rubygems/pull/2478 * Enable Style/MultilineIfThen in Rubocop https://github.com/rubygems/rubygems/pull/2479 * Fix required_ruby_version with prereleases and improve error message https://github.com/rubygems/rubygems/pull/2344 * Fix bundler rubygems binstub not properly looking for bundler https://github.com/rubygems/rubygems/pull/2426 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/resolver')
-rw-r--r--lib/rubygems/resolver/activation_request.rb12
-rw-r--r--lib/rubygems/resolver/api_set.rb11
-rw-r--r--lib/rubygems/resolver/api_specification.rb5
-rw-r--r--lib/rubygems/resolver/best_set.rb11
-rw-r--r--lib/rubygems/resolver/composed_set.rb11
-rw-r--r--lib/rubygems/resolver/conflict.rb10
-rw-r--r--lib/rubygems/resolver/current_set.rb3
-rw-r--r--lib/rubygems/resolver/dependency_request.rb8
-rw-r--r--lib/rubygems/resolver/git_set.rb11
-rw-r--r--lib/rubygems/resolver/git_specification.rb9
-rw-r--r--lib/rubygems/resolver/index_set.rb11
-rw-r--r--lib/rubygems/resolver/index_specification.rb7
-rw-r--r--lib/rubygems/resolver/installed_specification.rb7
-rw-r--r--lib/rubygems/resolver/installer_set.rb24
-rw-r--r--lib/rubygems/resolver/local_specification.rb3
-rw-r--r--lib/rubygems/resolver/lock_set.rb11
-rw-r--r--lib/rubygems/resolver/lock_specification.rb15
-rw-r--r--lib/rubygems/resolver/requirement_list.rb2
-rw-r--r--lib/rubygems/resolver/set.rb4
-rw-r--r--lib/rubygems/resolver/source_set.rb7
-rw-r--r--lib/rubygems/resolver/spec_specification.rb3
-rw-r--r--lib/rubygems/resolver/specification.rb5
-rw-r--r--lib/rubygems/resolver/vendor_set.rb9
-rw-r--r--lib/rubygems/resolver/vendor_specification.rb5
24 files changed, 93 insertions, 111 deletions
diff --git a/lib/rubygems/resolver/activation_request.rb b/lib/rubygems/resolver/activation_request.rb
index 135d75d6bc..b28e1bef32 100644
--- a/lib/rubygems/resolver/activation_request.rb
+++ b/lib/rubygems/resolver/activation_request.rb
@@ -22,13 +22,13 @@ class Gem::Resolver::ActivationRequest
# +others_possible+ indicates that other specifications may also match this
# activation request.
- def initialize spec, request, others_possible = true
+ def initialize(spec, request, others_possible = true)
@spec = spec
@request = request
@others_possible = others_possible
end
- def == other # :nodoc:
+ def ==(other) # :nodoc:
case other
when Gem::Specification
@spec == other
@@ -49,7 +49,7 @@ class Gem::Resolver::ActivationRequest
##
# Downloads a gem at +path+ and returns the file path.
- def download path
+ def download(path)
Gem.ensure_gem_subdirectories path
if @spec.respond_to? :sources
@@ -97,7 +97,7 @@ class Gem::Resolver::ActivationRequest
when false then # TODO remove at RubyGems 3
nil
else
- unless @others_possible.empty? then
+ unless @others_possible.empty?
others = @others_possible.map { |s| s.full_name }
" (others possible: #{others.join ', '})"
end
@@ -152,7 +152,7 @@ class Gem::Resolver::ActivationRequest
@request.requester
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[Activation request', ']' do
q.breakable
q.pp @spec
@@ -167,7 +167,7 @@ class Gem::Resolver::ActivationRequest
q.breakable
q.text 'others possible'
else
- unless @others_possible.empty? then
+ unless @others_possible.empty?
q.breakable
q.text 'others '
q.pp @others_possible.map { |s| s.full_name }
diff --git a/lib/rubygems/resolver/api_set.rb b/lib/rubygems/resolver/api_set.rb
index ee3046af63..6fd91e3b73 100644
--- a/lib/rubygems/resolver/api_set.rb
+++ b/lib/rubygems/resolver/api_set.rb
@@ -25,7 +25,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
# API URL +dep_uri+ which is described at
# http://guides.rubygems.org/rubygems-org-api
- def initialize dep_uri = 'https://rubygems.org/api/v1/dependencies'
+ def initialize(dep_uri = 'https://rubygems.org/api/v1/dependencies')
super()
dep_uri = URI dep_uri unless URI === dep_uri # for ruby 1.8
@@ -43,7 +43,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
# Return an array of APISpecification objects matching
# DependencyRequest +req+.
- def find_all req
+ def find_all(req)
res = []
return res unless @remote
@@ -65,7 +65,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
# A hint run by the resolver to allow the Set to fetch
# data for DependencyRequests +reqs+.
- def prefetch reqs
+ def prefetch(reqs)
return unless @remote
names = reqs.map { |r| r.dependency.name }
needed = names - @data.keys - @to_fetch
@@ -93,7 +93,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
end
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[APISet', ']' do
q.breakable
q.text "URI: #{@dep_uri}"
@@ -107,7 +107,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
##
# Return data for all versions of the gem +name+.
- def versions name # :nodoc:
+ def versions(name) # :nodoc:
if @data.key?(name)
return @data[name]
end
@@ -123,4 +123,3 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
end
end
-
diff --git a/lib/rubygems/resolver/api_specification.rb b/lib/rubygems/resolver/api_specification.rb
index c4e8a7cb54..9bbc095788 100644
--- a/lib/rubygems/resolver/api_specification.rb
+++ b/lib/rubygems/resolver/api_specification.rb
@@ -27,7 +27,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
end
end
- def == other # :nodoc:
+ def ==(other) # :nodoc:
self.class === other and
@set == other.set and
@name == other.name and
@@ -46,7 +46,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
Gem::Platform.match @platform
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[APISpecification', ']' do
q.breakable
q.text "name: #{name}"
@@ -88,4 +88,3 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
end
end
-
diff --git a/lib/rubygems/resolver/best_set.rb b/lib/rubygems/resolver/best_set.rb
index 4479535abe..cc91b65c0b 100644
--- a/lib/rubygems/resolver/best_set.rb
+++ b/lib/rubygems/resolver/best_set.rb
@@ -10,7 +10,7 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
# Creates a BestSet for the given +sources+ or Gem::sources if none are
# specified. +sources+ must be a Gem::SourceList.
- def initialize sources = Gem.sources
+ def initialize(sources = Gem.sources)
super()
@sources = sources
@@ -25,7 +25,7 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
end
end
- def find_all req # :nodoc:
+ def find_all(req) # :nodoc:
pick_sets if @remote and @sets.empty?
super
@@ -35,13 +35,13 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
retry
end
- def prefetch reqs # :nodoc:
+ def prefetch(reqs) # :nodoc:
pick_sets if @remote and @sets.empty?
super
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[BestSet', ']' do
q.breakable
q.text 'sets:'
@@ -58,7 +58,7 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
#
# The calling method must retry the exception to repeat the lookup.
- def replace_failed_api_set error # :nodoc:
+ def replace_failed_api_set(error) # :nodoc:
uri = error.uri
uri = URI uri unless URI === uri
uri.query = nil
@@ -76,4 +76,3 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
end
end
-
diff --git a/lib/rubygems/resolver/composed_set.rb b/lib/rubygems/resolver/composed_set.rb
index 0b65942dca..4baac9c75b 100644
--- a/lib/rubygems/resolver/composed_set.rb
+++ b/lib/rubygems/resolver/composed_set.rb
@@ -16,7 +16,7 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
# Creates a new ComposedSet containing +sets+. Use
# Gem::Resolver::compose_sets instead.
- def initialize *sets
+ def initialize(*sets)
super()
@sets = sets
@@ -26,7 +26,7 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
# When +allow_prerelease+ is set to +true+ prereleases gems are allowed to
# match dependencies.
- def prerelease= allow_prerelease
+ def prerelease=(allow_prerelease)
super
sets.each do |set|
@@ -37,7 +37,7 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
##
# Sets the remote network access for all composed sets.
- def remote= remote
+ def remote=(remote)
super
@sets.each { |set| set.remote = remote }
@@ -50,7 +50,7 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
##
# Finds all specs matching +req+ in all sets.
- def find_all req
+ def find_all(req)
@sets.map do |s|
s.find_all req
end.flatten
@@ -59,9 +59,8 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
##
# Prefetches +reqs+ in all sets.
- def prefetch reqs
+ def prefetch(reqs)
@sets.each { |s| s.prefetch(reqs) }
end
end
-
diff --git a/lib/rubygems/resolver/conflict.rb b/lib/rubygems/resolver/conflict.rb
index 7997f92950..fb1e661b21 100644
--- a/lib/rubygems/resolver/conflict.rb
+++ b/lib/rubygems/resolver/conflict.rb
@@ -27,7 +27,7 @@ class Gem::Resolver::Conflict
@failed_dep = failed_dep
end
- def == other # :nodoc:
+ def ==(other) # :nodoc:
self.class === other and
@dependency == other.dependency and
@activated == other.activated and
@@ -57,7 +57,7 @@ class Gem::Resolver::Conflict
requirement = dependency.requirement
alternates = dependency.matching_specs.map { |spec| spec.full_name }
- unless alternates.empty? then
+ unless alternates.empty?
matching = <<-MATCHING.chomp
Gems matching %s:
@@ -97,7 +97,7 @@ class Gem::Resolver::Conflict
@dependency.name == spec.name
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[Dependency conflict: ', ']' do
q.breakable
@@ -109,7 +109,7 @@ class Gem::Resolver::Conflict
q.pp @dependency
q.breakable
- if @dependency == @failed_dep then
+ if @dependency == @failed_dep
q.text ' failed'
else
q.text ' failed dependency '
@@ -121,7 +121,7 @@ class Gem::Resolver::Conflict
##
# Path of activations from the +current+ list.
- def request_path current
+ def request_path(current)
path = []
while current do
diff --git a/lib/rubygems/resolver/current_set.rb b/lib/rubygems/resolver/current_set.rb
index 265c639f15..d60e46389d 100644
--- a/lib/rubygems/resolver/current_set.rb
+++ b/lib/rubygems/resolver/current_set.rb
@@ -6,9 +6,8 @@
class Gem::Resolver::CurrentSet < Gem::Resolver::Set
- def find_all req
+ def find_all(req)
req.dependency.matching_specs
end
end
-
diff --git a/lib/rubygems/resolver/dependency_request.rb b/lib/rubygems/resolver/dependency_request.rb
index c2918911cd..1984aa9ddc 100644
--- a/lib/rubygems/resolver/dependency_request.rb
+++ b/lib/rubygems/resolver/dependency_request.rb
@@ -19,12 +19,12 @@ class Gem::Resolver::DependencyRequest
# Creates a new DependencyRequest for +dependency+ from +requester+.
# +requester may be nil if the request came from a user.
- def initialize dependency, requester
+ def initialize(dependency, requester)
@dependency = dependency
@requester = requester
end
- def == other # :nodoc:
+ def ==(other) # :nodoc:
case other
when Gem::Dependency
@dependency == other
@@ -48,7 +48,7 @@ class Gem::Resolver::DependencyRequest
# NOTE: #match? only matches prerelease versions when #dependency is a
# prerelease dependency.
- def match? spec, allow_prerelease = false
+ def match?(spec, allow_prerelease = false)
@dependency.match? spec, nil, allow_prerelease
end
@@ -95,7 +95,7 @@ class Gem::Resolver::DependencyRequest
@requester ? @requester.request : "(unknown)"
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[Dependency request ', ']' do
q.breakable
q.text @dependency.to_s
diff --git a/lib/rubygems/resolver/git_set.rb b/lib/rubygems/resolver/git_set.rb
index 723a202d7a..6340b92fae 100644
--- a/lib/rubygems/resolver/git_set.rb
+++ b/lib/rubygems/resolver/git_set.rb
@@ -43,7 +43,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
@specs = {}
end
- def add_git_gem name, repository, reference, submodules # :nodoc:
+ def add_git_gem(name, repository, reference, submodules) # :nodoc:
@repositories[name] = [repository, reference]
@need_submodules[repository] = submodules
end
@@ -56,7 +56,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
# This fills in the prefetch information as enough information about the gem
# is present in the arguments.
- def add_git_spec name, version, repository, reference, submodules # :nodoc:
+ def add_git_spec(name, version, repository, reference, submodules) # :nodoc:
add_git_gem name, repository, reference, submodules
source = Gem::Source::Git.new name, repository, reference
@@ -77,7 +77,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
##
# Finds all git gems matching +req+
- def find_all req
+ def find_all(req)
prefetch nil
specs.values.select do |spec|
@@ -88,7 +88,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
##
# Prefetches specifications from the git repositories in this set.
- def prefetch reqs
+ def prefetch(reqs)
return unless @specs.empty?
@repositories.each do |name, (repository, reference)|
@@ -104,7 +104,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
end
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[GitSet', ']' do
next if @repositories.empty?
q.breakable
@@ -120,4 +120,3 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
end
end
-
diff --git a/lib/rubygems/resolver/git_specification.rb b/lib/rubygems/resolver/git_specification.rb
index 2448797d3f..f43cfba853 100644
--- a/lib/rubygems/resolver/git_specification.rb
+++ b/lib/rubygems/resolver/git_specification.rb
@@ -6,14 +6,14 @@
class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
- def == other # :nodoc:
+ def ==(other) # :nodoc:
self.class === other and
@set == other.set and
@spec == other.spec and
@source == other.source
end
- def add_dependency dependency # :nodoc:
+ def add_dependency(dependency) # :nodoc:
spec.dependencies << dependency
end
@@ -21,7 +21,7 @@ class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
# Installing a git gem only involves building the extensions and generating
# the executables.
- def install options = {}
+ def install(options = {})
require 'rubygems/installer'
installer = Gem::Installer.for_spec spec, options
@@ -35,7 +35,7 @@ class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
installer.run_post_install_hooks
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[GitSpecification', ']' do
q.breakable
q.text "name: #{name}"
@@ -56,4 +56,3 @@ class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
end
end
-
diff --git a/lib/rubygems/resolver/index_set.rb b/lib/rubygems/resolver/index_set.rb
index 2450f14b4f..e32e1fa5ba 100644
--- a/lib/rubygems/resolver/index_set.rb
+++ b/lib/rubygems/resolver/index_set.rb
@@ -5,11 +5,11 @@
class Gem::Resolver::IndexSet < Gem::Resolver::Set
- def initialize source = nil # :nodoc:
+ def initialize(source = nil) # :nodoc:
super()
@f =
- if source then
+ if source
sources = Gem::SourceList.from [source]
Gem::SpecFetcher.new sources
@@ -36,7 +36,7 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
# Return an array of IndexSpecification objects matching
# DependencyRequest +req+.
- def find_all req
+ def find_all(req)
res = []
return res unless @remote
@@ -44,7 +44,7 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
name = req.dependency.name
@all[name].each do |uri, n|
- if req.match? n, @prerelease then
+ if req.match? n, @prerelease
res << Gem::Resolver::IndexSpecification.new(
self, n.name, n.version, uri, n.platform)
end
@@ -53,7 +53,7 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
res
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[IndexSet', ']' do
q.breakable
q.text 'sources:'
@@ -78,4 +78,3 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
end
end
-
diff --git a/lib/rubygems/resolver/index_specification.rb b/lib/rubygems/resolver/index_specification.rb
index 4340f46943..ed9423791c 100644
--- a/lib/rubygems/resolver/index_specification.rb
+++ b/lib/rubygems/resolver/index_specification.rb
@@ -15,7 +15,7 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification
# The +name+, +version+ and +platform+ are the name, version and platform of
# the gem.
- def initialize set, name, version, source, platform
+ def initialize(set, name, version, source, platform)
super()
@set = set
@@ -38,12 +38,12 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification
'#<%s %s source %s>' % [self.class, full_name, @source]
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[Index specification', ']' do
q.breakable
q.text full_name
- unless Gem::Platform::RUBY == @platform then
+ unless Gem::Platform::RUBY == @platform
q.breakable
q.text @platform.to_s
end
@@ -67,4 +67,3 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification
end
end
-
diff --git a/lib/rubygems/resolver/installed_specification.rb b/lib/rubygems/resolver/installed_specification.rb
index d9c6a5e5cf..9d996fc1da 100644
--- a/lib/rubygems/resolver/installed_specification.rb
+++ b/lib/rubygems/resolver/installed_specification.rb
@@ -5,7 +5,7 @@
class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification
- def == other # :nodoc:
+ def ==(other) # :nodoc:
self.class === other and
@set == other.set and
@spec == other.spec
@@ -15,7 +15,7 @@ class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification
# This is a null install as this specification is already installed.
# +options+ are ignored.
- def install options = {}
+ def install(options = {})
yield nil
end
@@ -30,7 +30,7 @@ class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification
super
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[InstalledSpecification', ']' do
q.breakable
q.text "name: #{name}"
@@ -56,4 +56,3 @@ class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification
end
end
-
diff --git a/lib/rubygems/resolver/installer_set.rb b/lib/rubygems/resolver/installer_set.rb
index f24293c0a0..f3827ad4e9 100644
--- a/lib/rubygems/resolver/installer_set.rb
+++ b/lib/rubygems/resolver/installer_set.rb
@@ -29,7 +29,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
##
# Creates a new InstallerSet that will look for gems in +domain+.
- def initialize domain
+ def initialize(domain)
super()
@domain = domain
@@ -50,7 +50,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
# Looks up the latest specification for +dependency+ and adds it to the
# always_install list.
- def add_always_install dependency
+ def add_always_install(dependency)
request = Gem::Resolver::DependencyRequest.new dependency, nil
found = find_all request
@@ -65,7 +65,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
Gem::Platform.local === s.platform
end
- if found.empty? then
+ if found.empty?
exc = Gem::UnsatisfiableDependencyError.new request
exc.errors = errors
@@ -83,7 +83,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
# Adds a local gem requested using +dep_name+ with the given +spec+ that can
# be loaded and installed using the +source+.
- def add_local dep_name, spec, source
+ def add_local(dep_name, spec, source)
@local[dep_name] = [spec, source]
end
@@ -112,7 +112,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
# Returns an array of IndexSpecification objects matching DependencyRequest
# +req+.
- def find_all req
+ def find_all(req)
res = []
dep = req.dependency
@@ -128,7 +128,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
res << Gem::Resolver::InstalledSpecification.new(self, gemspec)
end unless @ignore_installed
- if consider_local? then
+ if consider_local?
matching_local = @local.values.select do |spec, _|
req.match? spec
end.map do |spec, source|
@@ -138,7 +138,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
res.concat matching_local
begin
- if local_spec = @local_source.find_gem(name, dep.requirement) then
+ if local_spec = @local_source.find_gem(name, dep.requirement)
res << Gem::Resolver::IndexSpecification.new(
self, local_spec.name, local_spec.version,
@local_source, local_spec.platform)
@@ -161,7 +161,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
@remote_set.prefetch(reqs) if consider_remote?
end
- def prerelease= allow_prerelease
+ def prerelease=(allow_prerelease)
super
@remote_set.prerelease = allow_prerelease
@@ -179,7 +179,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
# Called from IndexSpecification to get a true Specification
# object.
- def load_spec name, ver, platform, source # :nodoc:
+ def load_spec(name, ver, platform, source) # :nodoc:
key = "#{name}-#{ver}-#{platform}"
@specs.fetch key do
@@ -192,13 +192,13 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
##
# Has a local gem for +dep_name+ been added to this set?
- def local? dep_name # :nodoc:
+ def local?(dep_name) # :nodoc:
spec, _ = @local[dep_name]
spec
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[InstallerSet', ']' do
q.breakable
q.text "domain: #{@domain}"
@@ -213,7 +213,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
end
end
- def remote= remote # :nodoc:
+ def remote=(remote) # :nodoc:
case @domain
when :local then
@domain = :both if remote
diff --git a/lib/rubygems/resolver/local_specification.rb b/lib/rubygems/resolver/local_specification.rb
index 1d9d22f0ac..7418cfcc86 100644
--- a/lib/rubygems/resolver/local_specification.rb
+++ b/lib/rubygems/resolver/local_specification.rb
@@ -17,7 +17,7 @@ class Gem::Resolver::LocalSpecification < Gem::Resolver::SpecSpecification
true
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[LocalSpecification', ']' do
q.breakable
q.text "name: #{name}"
@@ -39,4 +39,3 @@ class Gem::Resolver::LocalSpecification < Gem::Resolver::SpecSpecification
end
end
-
diff --git a/lib/rubygems/resolver/lock_set.rb b/lib/rubygems/resolver/lock_set.rb
index 7fddc93e1c..4002a963a4 100644
--- a/lib/rubygems/resolver/lock_set.rb
+++ b/lib/rubygems/resolver/lock_set.rb
@@ -9,7 +9,7 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
##
# Creates a new LockSet from the given +sources+
- def initialize sources
+ def initialize(sources)
super()
@sources = sources.map do |source|
@@ -26,7 +26,7 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
# The specification's set will be the current set, and the source will be
# the current set's source.
- def add name, version, platform # :nodoc:
+ def add(name, version, platform) # :nodoc:
version = Gem::Version.new version
specs = [
Gem::Resolver::LockSpecification.new(self, name, version, @sources, platform)
@@ -41,7 +41,7 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
# Returns an Array of IndexSpecification objects matching the
# DependencyRequest +req+.
- def find_all req
+ def find_all(req)
@specs.select do |spec|
req.match? spec
end
@@ -51,7 +51,7 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
# Loads a Gem::Specification with the given +name+, +version+ and
# +platform+. +source+ is ignored.
- def load_spec name, version, platform, source # :nodoc:
+ def load_spec(name, version, platform, source) # :nodoc:
dep = Gem::Dependency.new name, version
found = @specs.find do |spec|
@@ -63,7 +63,7 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
found.source.fetch_spec tuple
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[LockSet', ']' do
q.breakable
q.text 'source:'
@@ -80,4 +80,3 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
end
end
-
diff --git a/lib/rubygems/resolver/lock_specification.rb b/lib/rubygems/resolver/lock_specification.rb
index f485675673..e29b567de4 100644
--- a/lib/rubygems/resolver/lock_specification.rb
+++ b/lib/rubygems/resolver/lock_specification.rb
@@ -9,7 +9,7 @@ class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
attr_reader :sources
- def initialize set, name, version, sources, platform
+ def initialize(set, name, version, sources, platform)
super()
@name = name
@@ -27,10 +27,10 @@ class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
# This is a null install as a locked specification is considered installed.
# +options+ are ignored.
- def install options = {}
+ def install(options = {})
destination = options[:install_dir] || Gem.dir
- if File.exist? File.join(destination, 'specifications', spec.spec_name) then
+ if File.exist? File.join(destination, 'specifications', spec.spec_name)
yield nil
return
end
@@ -41,11 +41,11 @@ class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
##
# Adds +dependency+ from the lockfile to this specification
- def add_dependency dependency # :nodoc:
+ def add_dependency(dependency) # :nodoc:
@dependencies << dependency
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[LockSpecification', ']' do
q.breakable
q.text "name: #{@name}"
@@ -53,12 +53,12 @@ class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
q.breakable
q.text "version: #{@version}"
- unless @platform == Gem::Platform::RUBY then
+ unless @platform == Gem::Platform::RUBY
q.breakable
q.text "platform: #{@platform}"
end
- unless @dependencies.empty? then
+ unless @dependencies.empty?
q.breakable
q.text 'dependencies:'
q.breakable
@@ -85,4 +85,3 @@ class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
end
end
-
diff --git a/lib/rubygems/resolver/requirement_list.rb b/lib/rubygems/resolver/requirement_list.rb
index 2768c80170..98d086e63c 100644
--- a/lib/rubygems/resolver/requirement_list.rb
+++ b/lib/rubygems/resolver/requirement_list.rb
@@ -18,7 +18,7 @@ class Gem::Resolver::RequirementList
@list = []
end
- def initialize_copy other # :nodoc:
+ def initialize_copy(other) # :nodoc:
@exact = @exact.dup
@list = @list.dup
end
diff --git a/lib/rubygems/resolver/set.rb b/lib/rubygems/resolver/set.rb
index 11704d5c4c..242f9cd3dc 100644
--- a/lib/rubygems/resolver/set.rb
+++ b/lib/rubygems/resolver/set.rb
@@ -31,7 +31,7 @@ class Gem::Resolver::Set
# The find_all method must be implemented. It returns all Resolver
# Specification objects matching the given DependencyRequest +req+.
- def find_all req
+ def find_all(req)
raise NotImplementedError
end
@@ -43,7 +43,7 @@ class Gem::Resolver::Set
# When overridden, the #prefetch method should look up specifications
# matching +reqs+.
- def prefetch reqs
+ def prefetch(reqs)
end
##
diff --git a/lib/rubygems/resolver/source_set.rb b/lib/rubygems/resolver/source_set.rb
index 696d963732..8e799514fd 100644
--- a/lib/rubygems/resolver/source_set.rb
+++ b/lib/rubygems/resolver/source_set.rb
@@ -16,7 +16,7 @@ class Gem::Resolver::SourceSet < Gem::Resolver::Set
@sets = {}
end
- def find_all req # :nodoc:
+ def find_all(req) # :nodoc:
if set = get_set(req.dependency.name)
set.find_all req
else
@@ -25,7 +25,7 @@ class Gem::Resolver::SourceSet < Gem::Resolver::Set
end
# potentially no-op
- def prefetch reqs # :nodoc:
+ def prefetch(reqs) # :nodoc:
reqs.each do |req|
if set = get_set(req.dependency.name)
set.prefetch reqs
@@ -33,7 +33,7 @@ class Gem::Resolver::SourceSet < Gem::Resolver::Set
end
end
- def add_source_gem name, source
+ def add_source_gem(name, source)
@links[name] = source
end
@@ -45,4 +45,3 @@ class Gem::Resolver::SourceSet < Gem::Resolver::Set
end
end
-
diff --git a/lib/rubygems/resolver/spec_specification.rb b/lib/rubygems/resolver/spec_specification.rb
index 35ee8cc247..d0e744f3a7 100644
--- a/lib/rubygems/resolver/spec_specification.rb
+++ b/lib/rubygems/resolver/spec_specification.rb
@@ -10,7 +10,7 @@ class Gem::Resolver::SpecSpecification < Gem::Resolver::Specification
# +spec+. The +source+ is either where the +spec+ came from, or should be
# loaded from.
- def initialize set, spec, source = nil
+ def initialize(set, spec, source = nil)
@set = set
@source = source
@spec = spec
@@ -54,4 +54,3 @@ class Gem::Resolver::SpecSpecification < Gem::Resolver::Specification
end
end
-
diff --git a/lib/rubygems/resolver/specification.rb b/lib/rubygems/resolver/specification.rb
index 530ea9994d..7c1e9be702 100644
--- a/lib/rubygems/resolver/specification.rb
+++ b/lib/rubygems/resolver/specification.rb
@@ -81,7 +81,7 @@ class Gem::Resolver::Specification
# After installation #spec is updated to point to the just-installed
# specification.
- def install options = {}
+ def install(options = {})
require 'rubygems/installer'
gem = download options
@@ -93,7 +93,7 @@ class Gem::Resolver::Specification
@spec = installer.install
end
- def download options
+ def download(options)
dir = options[:install_dir] || Gem.dir
Gem.ensure_gem_subdirectories dir
@@ -112,4 +112,3 @@ class Gem::Resolver::Specification
false
end
end
-
diff --git a/lib/rubygems/resolver/vendor_set.rb b/lib/rubygems/resolver/vendor_set.rb
index f30ce534af..7e2e917d5c 100644
--- a/lib/rubygems/resolver/vendor_set.rb
+++ b/lib/rubygems/resolver/vendor_set.rb
@@ -32,7 +32,7 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set
# Adds a specification to the set with the given +name+ which has been
# unpacked into the given +directory+.
- def add_vendor_gem name, directory # :nodoc:
+ def add_vendor_gem(name, directory) # :nodoc:
gemspec = File.join directory, "#{name}.gemspec"
spec = Gem::Specification.load gemspec
@@ -52,7 +52,7 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set
# Returns an Array of VendorSpecification objects matching the
# DependencyRequest +req+.
- def find_all req
+ def find_all(req)
@specs.values.select do |spec|
req.match? spec
end.map do |spec|
@@ -65,11 +65,11 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set
# Loads a spec with the given +name+. +version+, +platform+ and +source+ are
# ignored.
- def load_spec name, version, platform, source # :nodoc:
+ def load_spec(name, version, platform, source) # :nodoc:
@specs.fetch name
end
- def pretty_print q # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group 2, '[VendorSet', ']' do
next if @directories.empty?
q.breakable
@@ -85,4 +85,3 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set
end
end
-
diff --git a/lib/rubygems/resolver/vendor_specification.rb b/lib/rubygems/resolver/vendor_specification.rb
index c624f3e834..56f2e6eb2c 100644
--- a/lib/rubygems/resolver/vendor_specification.rb
+++ b/lib/rubygems/resolver/vendor_specification.rb
@@ -6,7 +6,7 @@
class Gem::Resolver::VendorSpecification < Gem::Resolver::SpecSpecification
- def == other # :nodoc:
+ def ==(other) # :nodoc:
self.class === other and
@set == other.set and
@spec == other.spec and
@@ -17,9 +17,8 @@ class Gem::Resolver::VendorSpecification < Gem::Resolver::SpecSpecification
# This is a null install as this gem was unpacked into a directory.
# +options+ are ignored.
- def install options = {}
+ def install(options = {})
yield nil
end
end
-