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
This commit is contained in:
hsbt 2018-11-21 10:20:47 +00:00
parent 2f023c5dba
commit 5335ce0e06
247 changed files with 1290 additions and 1363 deletions

View file

@ -36,7 +36,7 @@ class Gem::Dependency
# argument can optionally be the dependency type, which defaults to
# <tt>:runtime</tt>.
def initialize name, *requirements
def initialize(name, *requirements)
case name
when String then # ok
when Regexp then
@ -76,7 +76,7 @@ class Gem::Dependency
end
def inspect # :nodoc:
if prerelease? then
if prerelease?
"<%s type=%p name=%p requirements=%p prerelease=ok>" %
[self.class, self.type, self.name, requirement.to_s]
else
@ -100,7 +100,7 @@ class Gem::Dependency
@requirement.none?
end
def pretty_print q # :nodoc:
def pretty_print(q) # :nodoc:
q.group 1, 'Gem::Dependency.new(', ')' do
q.pp name
q.text ','
@ -152,7 +152,7 @@ class Gem::Dependency
end
def to_s # :nodoc:
if type != :runtime then
if type != :runtime
"#{name} (#{requirement}, #{type})"
else
"#{name} (#{requirement})"
@ -170,7 +170,7 @@ class Gem::Dependency
@type == :runtime || !@type
end
def == other # :nodoc:
def ==(other) # :nodoc:
Gem::Dependency === other &&
self.name == other.name &&
self.type == other.type &&
@ -180,7 +180,7 @@ class Gem::Dependency
##
# Dependencies are ordered by name.
def <=> other
def <=>(other)
self.name <=> other.name
end
@ -190,7 +190,7 @@ class Gem::Dependency
# other has only an equal version requirement that satisfies this
# dependency.
def =~ other
def =~(other)
unless Gem::Dependency === other
return unless other.respond_to?(:name) && other.respond_to?(:version)
other = Gem::Dependency.new other.name, other.version
@ -222,7 +222,7 @@ class Gem::Dependency
# NOTE: Unlike #matches_spec? this method does not return true when the
# version is a prerelease version unless this is a prerelease dependency.
def match? obj, version=nil, allow_prerelease=false
def match?(obj, version=nil, allow_prerelease=false)
if !version
name = obj.name
version = obj.version
@ -249,7 +249,7 @@ class Gem::Dependency
# returns true when +spec+ is a prerelease version even if this dependency
# is not a prerelease dependency.
def matches_spec? spec
def matches_spec?(spec)
return false unless name === spec.name
return true if requirement.none?
@ -259,8 +259,8 @@ class Gem::Dependency
##
# Merges the requirements of +other+ into this dependency
def merge other
unless name == other.name then
def merge(other)
unless name == other.name
raise ArgumentError,
"#{self} and #{other} have different names"
end
@ -275,7 +275,7 @@ class Gem::Dependency
self.class.new name, self_req.as_list.concat(other_req.as_list)
end
def matching_specs platform_only = false
def matching_specs(platform_only = false)
env_req = Gem.env_requirement(name)
matches = Gem::Specification.stubs_for(name).find_all { |spec|
requirement.satisfied_by?(spec.version) && env_req.satisfied_by?(spec.version)
@ -304,7 +304,7 @@ class Gem::Dependency
# TODO: check Gem.activated_spec[self.name] in case matches falls outside
if matches.empty? then
if matches.empty?
specs = Gem::Specification.stubs_for name
if specs.empty?