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 () | |
tree | c63321cb7c7c5c15454a79d81123c7188be2c51e /lib/rubygems/commands/dependency_command.rb | |
parent | 2f023c5dbaadede9ceac3eb9ac0e73f3050e5ada (diff) |
Merge master branch from rubygems/rubygems upstream.
* Enable Style/MethodDefParentheses in Rubocop https://.com/rubygems/rubygems/pull/2478 * Enable Style/MultilineIfThen in Rubocop https://.com/rubygems/rubygems/pull/2479 * Fix required_ruby_version with prereleases and improve error message https://.com/rubygems/rubygems/pull/2344 * Fix bundler rubygems binstub not properly looking for bundler https://.com/rubygems/rubygems/pull/2426 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/rubygems/commands/dependency_command.rb | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -54,7 +54,7 @@ use with other commands. "#{program_name} REGEXP" end - def fetch_remote_specs dependency # :nodoc: fetcher = Gem::SpecFetcher.fetcher ss, = fetcher.spec_for_dependency dependency @@ -62,7 +62,7 @@ use with other commands. ss.map { |spec, _| spec } end - def fetch_specs name_pattern, dependency # :nodoc: specs = [] if local? @@ -79,7 +79,7 @@ use with other commands. specs.uniq.sort end - def gem_dependency pattern, version, prerelease # :nodoc: dependency = Gem::Deprecate.skip_during { Gem::Dependency.new pattern, version } @@ -89,9 +89,9 @@ use with other commands. dependency end - def display_pipe specs # :nodoc: specs.each do |spec| - unless spec.dependencies.empty? then spec.dependencies.sort_by { |dep| dep.name }.each do |dep| say "#{dep.name} --version '#{dep.requirement}'" end @@ -99,12 +99,12 @@ use with other commands. end end - def display_readable specs, reverse # :nodoc: response = String.new specs.each do |spec| response << print_dependencies(spec) - unless reverse[spec.full_name].empty? then response << " Used by\n" reverse[spec.full_name].each do |sp, dep| response << " #{sp} (#{dep})\n" @@ -128,7 +128,7 @@ use with other commands. reverse = reverse_dependencies specs - if options[:pipe_format] then display_pipe specs else display_readable specs, reverse @@ -136,13 +136,13 @@ use with other commands. end def ensure_local_only_reverse_dependencies # :nodoc: - if options[:reverse_dependencies] and remote? and not local? then alert_error 'Only reverse dependencies for local gems are supported.' terminate_interaction 1 end end - def ensure_specs specs # :nodoc: return unless specs.empty? patterns = options[:args].join ',' @@ -155,7 +155,7 @@ use with other commands. def print_dependencies(spec, level = 0) # :nodoc: response = String.new response << ' ' * level + "Gem #{spec.full_name}\n" - unless spec.dependencies.empty? then spec.dependencies.sort_by { |dep| dep.name }.each do |dep| response << ' ' * level + " #{dep}\n" end @@ -163,7 +163,7 @@ use with other commands. response end - def remote_specs dependency # :nodoc: fetcher = Gem::SpecFetcher.fetcher ss, _ = fetcher.spec_for_dependency dependency @@ -171,7 +171,7 @@ use with other commands. ss.map { |s,o| s } end - def reverse_dependencies specs # :nodoc: reverse = Hash.new { |h, k| h[k] = [] } return reverse unless options[:reverse_dependencies] @@ -186,7 +186,7 @@ use with other commands. ## # Returns an Array of [specification, dep] that are satisfied by +spec+. - def find_reverse_dependencies spec # :nodoc: result = [] Gem::Specification.each do |sp| @@ -194,7 +194,7 @@ use with other commands. dep = Gem::Dependency.new(*dep) unless Gem::Dependency === dep if spec.name == dep.name and - dep.requirement.satisfied_by?(spec.version) then result << [sp.full_name, dep] end end @@ -205,10 +205,10 @@ use with other commands. private - def name_pattern args args << '' if args.empty? - if args.length == 1 and args.first =~ /\A\/(.*)\/(i)?\z/m then flags = $2 ? Regexp::IGNORECASE : nil Regexp.new $1, flags else |