diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-14 08:59:02 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-14 08:59:02 +0000 |
commit | 269503b544247b5b3e30dbe60a0bab4f2ca00e4e () | |
tree | a6d0a3a9b34017c4c84d997152a3aaf3086e1ce1 /lib/rubygems/commands/dependency_command.rb | |
parent | 2614d9ba2fb5ad171200cccc88f42fa659b527c6 (diff) |
Revert r42938 "* lib/rubygems: Update to RubyGems 2.1.3"
It breaks build. http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20130913T200302Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/rubygems/commands/dependency_command.rb | 158 |
1 files changed, 105 insertions, 53 deletions
@@ -38,89 +38,121 @@ class Gem::Commands::DependencyCommand < Gem::Command "--local --version '#{Gem::Requirement.default}' --no-reverse-dependencies" end def usage # :nodoc: "#{program_name} GEMNAME" end - def execute - if options[:reverse_dependencies] and remote? and not local? then - alert_error 'Only reverse dependencies for local gems are supported.' - terminate_interaction 1 - end - options[:args] << '' if options[:args].empty? - pattern = if options[:args].length == 1 and - options[:args].first =~ /\A\/(.*)\/(i)?\z/m then flags = $2 ? Regexp::IGNORECASE : nil Regexp.new $1, flags else - /\A#{Regexp.union(*options[:args])}/ end - # TODO: deprecate for real damnit dependency = Gem::Deprecate.skip_during { - Gem::Dependency.new pattern, options[:version] } - dependency.prerelease = options[:prerelease] - specs = [] - specs.concat dependency.matching_specs if local? - if remote? and not options[:reverse_dependencies] then - fetcher = Gem::SpecFetcher.fetcher - ss, _ = fetcher.spec_for_dependency dependency - ss.each { |s,o| specs << s } end - if specs.empty? then - patterns = options[:args].join ',' - say "No gems found matching #{patterns} (#{options[:version]})" if - Gem.configuration.verbose - terminate_interaction 1 - end - specs = specs.uniq.sort - reverse = Hash.new { |h, k| h[k] = [] } - if options[:reverse_dependencies] then - specs.each do |spec| - reverse[spec.full_name] = find_reverse_dependencies spec - end - end if options[:pipe_format] then - specs.each do |spec| - unless spec.dependencies.empty? - spec.dependencies.sort_by { |dep| dep.name }.each do |dep| - say "#{dep.name} --version '#{dep.requirement}'" - end - end - end else - response = '' - - 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" - end - end - response << "\n" - end - say response end end - def print_dependencies(spec, level = 0) response = '' response << ' ' * level + "Gem #{spec.full_name}\n" unless spec.dependencies.empty? then @@ -131,10 +163,30 @@ class Gem::Commands::DependencyCommand < Gem::Command response end ## # Returns an Array of [specification, dep] that are satisfied by +spec+. - def find_reverse_dependencies(spec) result = [] Gem::Specification.each do |sp| |