diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
commit | 5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 (patch) | |
tree | c63321cb7c7c5c15454a79d81123c7188be2c51e /lib/rubygems/dependency.rb | |
parent | 2f023c5dbaadede9ceac3eb9ac0e73f3050e5ada (diff) | |
download | ruby-5335ce0e060c7a2a0b01c57f8f8a64254f2658e1.tar.gz |
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/dependency.rb')
-rw-r--r-- | lib/rubygems/dependency.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb index c06df0fa35..33ba1968d1 100644 --- a/lib/rubygems/dependency.rb +++ b/lib/rubygems/dependency.rb @@ -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? |