rubygems-update 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- data/ChangeLog +60 -0
 - data/lib/rubygems.rb +18 -15
 - data/lib/rubygems/builder.rb +29 -23
 - data/lib/rubygems/{cmd_manager.rb → command_manager.rb} +35 -24
 - data/lib/rubygems/commands/build_command.rb +57 -0
 - data/lib/rubygems/commands/cert_command.rb +83 -0
 - data/lib/rubygems/commands/check_command.rb +74 -0
 - data/lib/rubygems/commands/cleanup_command.rb +75 -0
 - data/lib/rubygems/commands/contents_command.rb +66 -0
 - data/lib/rubygems/commands/dependency_command.rb +105 -0
 - data/lib/rubygems/commands/environment_command.rb +59 -0
 - data/lib/rubygems/commands/help_command.rb +82 -0
 - data/lib/rubygems/commands/install_command.rb +139 -0
 - data/lib/rubygems/commands/list_command.rb +33 -0
 - data/lib/rubygems/commands/outdated_command.rb +21 -0
 - data/lib/rubygems/commands/pristine_command.rb +103 -0
 - data/lib/rubygems/commands/query_command.rb +86 -0
 - data/lib/rubygems/commands/rdoc_command.rb +75 -0
 - data/lib/rubygems/commands/search_command.rb +35 -0
 - data/lib/rubygems/commands/sources_command.rb +73 -0
 - data/lib/rubygems/commands/specification_command.rb +58 -0
 - data/lib/rubygems/commands/uninstall_command.rb +51 -0
 - data/lib/rubygems/commands/unpack_command.rb +76 -0
 - data/lib/rubygems/commands/update_command.rb +102 -0
 - data/lib/rubygems/digest/digest_adapter.rb +40 -0
 - data/lib/rubygems/digest/md5.rb +20 -0
 - data/lib/rubygems/digest/sha1.rb +17 -0
 - data/lib/rubygems/digest/sha2.rb +17 -0
 - data/lib/rubygems/format.rb +1 -1
 - data/lib/rubygems/gem_commands.rb +6 -1407
 - data/lib/rubygems/gem_runner.rb +2 -2
 - data/lib/rubygems/installer.rb +13 -5
 - data/lib/rubygems/open-uri.rb +2 -2
 - data/lib/rubygems/package.rb +13 -14
 - data/lib/rubygems/rubygems_version.rb +1 -1
 - data/lib/rubygems/source_index.rb +4 -4
 - data/lib/rubygems/specification.rb +5 -0
 - data/lib/rubygems/validator.rb +8 -8
 - data/setup.rb +806 -588
 - data/test/gemutilities.rb +2 -2
 - data/test/test_builder.rb +15 -0
 - data/test/test_check_command.rb +1 -1
 - data/test/test_command.rb +1 -1
 - data/test/test_gem_digest.rb +44 -0
 - data/test/test_gem_outdated_command.rb +2 -1
 - data/test/test_gem_sources_command.rb +11 -6
 - data/test/test_installer.rb +1 -1
 - data/test/test_open_uri.rb +14 -0
 - data/test/test_parse_commands.rb +25 -25
 - data/test/test_process_commands.rb +5 -5
 - data/test/test_specific_extras.rb +1 -1
 - data/test/test_validator.rb +3 -3
 - metadata +30 -4
 
| 
         @@ -0,0 +1,75 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Gem
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Commands
         
     | 
| 
      
 3 
     | 
    
         
            +
                class CleanupCommand < Command
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def initialize
         
     | 
| 
      
 5 
     | 
    
         
            +
                    super(
         
     | 
| 
      
 6 
     | 
    
         
            +
                      'cleanup',
         
     | 
| 
      
 7 
     | 
    
         
            +
                      'Clean up old versions of installed gems in the local repository',
         
     | 
| 
      
 8 
     | 
    
         
            +
                      {
         
     | 
| 
      
 9 
     | 
    
         
            +
                        :force => false, 
         
     | 
| 
      
 10 
     | 
    
         
            +
                        :test => false, 
         
     | 
| 
      
 11 
     | 
    
         
            +
                        :install_dir => Gem.dir
         
     | 
| 
      
 12 
     | 
    
         
            +
                      })
         
     | 
| 
      
 13 
     | 
    
         
            +
                    add_option('-d', '--dryrun', "") do |value, options|
         
     | 
| 
      
 14 
     | 
    
         
            +
                      options[:dryrun] = true
         
     | 
| 
      
 15 
     | 
    
         
            +
                    end
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                
         
     | 
| 
      
 18 
     | 
    
         
            +
                  def defaults_str
         
     | 
| 
      
 19 
     | 
    
         
            +
                    "--no-dryrun"
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def arguments
         
     | 
| 
      
 23 
     | 
    
         
            +
                    "GEMNAME(s)   name of gem(s) to cleanup"
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 27 
     | 
    
         
            +
                    say "Cleaning up installed gems..."
         
     | 
| 
      
 28 
     | 
    
         
            +
                    srcindex = Gem::SourceIndex.from_installed_gems
         
     | 
| 
      
 29 
     | 
    
         
            +
                    primary_gems = {}
         
     | 
| 
      
 30 
     | 
    
         
            +
                    srcindex.each do |name, spec|
         
     | 
| 
      
 31 
     | 
    
         
            +
                      if primary_gems[spec.name].nil? or primary_gems[spec.name].version < spec.version
         
     | 
| 
      
 32 
     | 
    
         
            +
                        primary_gems[spec.name] = spec
         
     | 
| 
      
 33 
     | 
    
         
            +
                      end
         
     | 
| 
      
 34 
     | 
    
         
            +
                    end
         
     | 
| 
      
 35 
     | 
    
         
            +
                    gems_to_cleanup = []
         
     | 
| 
      
 36 
     | 
    
         
            +
                    if ! options[:args].empty?
         
     | 
| 
      
 37 
     | 
    
         
            +
                      options[:args].each do |gem_name|
         
     | 
| 
      
 38 
     | 
    
         
            +
                        specs = Gem.cache.search(/^#{gem_name}$/i)
         
     | 
| 
      
 39 
     | 
    
         
            +
                        specs.each do |spec|
         
     | 
| 
      
 40 
     | 
    
         
            +
                          gems_to_cleanup << spec
         
     | 
| 
      
 41 
     | 
    
         
            +
                        end
         
     | 
| 
      
 42 
     | 
    
         
            +
                      end
         
     | 
| 
      
 43 
     | 
    
         
            +
                    else
         
     | 
| 
      
 44 
     | 
    
         
            +
                      srcindex.each do |name, spec|
         
     | 
| 
      
 45 
     | 
    
         
            +
                          gems_to_cleanup << spec
         
     | 
| 
      
 46 
     | 
    
         
            +
                      end
         
     | 
| 
      
 47 
     | 
    
         
            +
                    end
         
     | 
| 
      
 48 
     | 
    
         
            +
                    gems_to_cleanup = gems_to_cleanup.select { |spec|
         
     | 
| 
      
 49 
     | 
    
         
            +
                      primary_gems[spec.name].version != spec.version
         
     | 
| 
      
 50 
     | 
    
         
            +
                    }
         
     | 
| 
      
 51 
     | 
    
         
            +
                    uninstall_command = command_manager['uninstall']
         
     | 
| 
      
 52 
     | 
    
         
            +
                    deplist = DependencyList.new
         
     | 
| 
      
 53 
     | 
    
         
            +
                    gems_to_cleanup.uniq.each do |spec| deplist.add(spec) end
         
     | 
| 
      
 54 
     | 
    
         
            +
                    deplist.dependency_order.each do |spec|
         
     | 
| 
      
 55 
     | 
    
         
            +
                      if options[:dryrun]
         
     | 
| 
      
 56 
     | 
    
         
            +
                        say "Dry Run Mode: Would uninstall #{spec.full_name}"
         
     | 
| 
      
 57 
     | 
    
         
            +
                      else
         
     | 
| 
      
 58 
     | 
    
         
            +
                        say "Attempting uninstall on #{spec.full_name}"
         
     | 
| 
      
 59 
     | 
    
         
            +
                        options[:args] = [spec.name]
         
     | 
| 
      
 60 
     | 
    
         
            +
                        options[:version] = "= #{spec.version}"
         
     | 
| 
      
 61 
     | 
    
         
            +
                        options[:executables] = true
         
     | 
| 
      
 62 
     | 
    
         
            +
                        uninstall_command.merge_options(options)
         
     | 
| 
      
 63 
     | 
    
         
            +
                        begin
         
     | 
| 
      
 64 
     | 
    
         
            +
                          uninstall_command.execute
         
     | 
| 
      
 65 
     | 
    
         
            +
                        rescue Gem::DependencyRemovalException => ex
         
     | 
| 
      
 66 
     | 
    
         
            +
                          say "Unable to uninstall #{spec.full_name} ... continuing with remaining gems"
         
     | 
| 
      
 67 
     | 
    
         
            +
                        end
         
     | 
| 
      
 68 
     | 
    
         
            +
                      end
         
     | 
| 
      
 69 
     | 
    
         
            +
                    end
         
     | 
| 
      
 70 
     | 
    
         
            +
                    say "Clean Up Complete"
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
                  
         
     | 
| 
      
 74 
     | 
    
         
            +
              end
         
     | 
| 
      
 75 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,66 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Gem
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Commands
         
     | 
| 
      
 3 
     | 
    
         
            +
                class ContentsCommand < Command
         
     | 
| 
      
 4 
     | 
    
         
            +
                  include CommandAids
         
     | 
| 
      
 5 
     | 
    
         
            +
                  include VersionOption
         
     | 
| 
      
 6 
     | 
    
         
            +
                  def initialize
         
     | 
| 
      
 7 
     | 
    
         
            +
                    super(
         
     | 
| 
      
 8 
     | 
    
         
            +
                      'contents',
         
     | 
| 
      
 9 
     | 
    
         
            +
                      'Display the contents of the installed gems',
         
     | 
| 
      
 10 
     | 
    
         
            +
                      { :list => true, :specdirs => [] })
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                    add_version_option('contents')
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                    add_option("-l","--list",'List the files inside a Gem') do |v,o|
         
     | 
| 
      
 15 
     | 
    
         
            +
                      o[:list] = true
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
                  
         
     | 
| 
      
 18 
     | 
    
         
            +
                    add_option('-s','--spec-dir a,b,c', Array, "Search for gems under specific paths") do |v,o|
         
     | 
| 
      
 19 
     | 
    
         
            +
                      o[:specdirs] = v
         
     | 
| 
      
 20 
     | 
    
         
            +
                    end
         
     | 
| 
      
 21 
     | 
    
         
            +
                  
         
     | 
| 
      
 22 
     | 
    
         
            +
                    add_option('-V','--verbose','Be verbose when showing status') do |v,o|
         
     | 
| 
      
 23 
     | 
    
         
            +
                      o[:verbose] = v
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  def execute(io=STDOUT)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    if options[:list]
         
     | 
| 
      
 29 
     | 
    
         
            +
                      version = options[:version] || "> 0.0.0"
         
     | 
| 
      
 30 
     | 
    
         
            +
                      gem = get_one_gem_name
         
     | 
| 
      
 31 
     | 
    
         
            +
                    
         
     | 
| 
      
 32 
     | 
    
         
            +
                      s = options[:specdirs].map do |i|
         
     | 
| 
      
 33 
     | 
    
         
            +
                        [i, File.join(i,"specifications")]
         
     | 
| 
      
 34 
     | 
    
         
            +
                      end.flatten
         
     | 
| 
      
 35 
     | 
    
         
            +
                    
         
     | 
| 
      
 36 
     | 
    
         
            +
                      if s.empty?
         
     | 
| 
      
 37 
     | 
    
         
            +
                        s = Gem::SourceIndex.installed_spec_directories
         
     | 
| 
      
 38 
     | 
    
         
            +
                        path_kind = "default gem paths"
         
     | 
| 
      
 39 
     | 
    
         
            +
                        system = true
         
     | 
| 
      
 40 
     | 
    
         
            +
                      else
         
     | 
| 
      
 41 
     | 
    
         
            +
                        path_kind = "specified path"
         
     | 
| 
      
 42 
     | 
    
         
            +
                        system = false
         
     | 
| 
      
 43 
     | 
    
         
            +
                      end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                      si = Gem::SourceIndex.from_gems_in(*s)
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                      gem_spec = si.search(gem, version).last
         
     | 
| 
      
 48 
     | 
    
         
            +
                      unless gem_spec
         
     | 
| 
      
 49 
     | 
    
         
            +
                        io.puts "Unable to find gem '#{gem}' in #{path_kind}"
         
     | 
| 
      
 50 
     | 
    
         
            +
                        if options[:verbose]
         
     | 
| 
      
 51 
     | 
    
         
            +
                          io.puts "\nDirectories searched:"
         
     | 
| 
      
 52 
     | 
    
         
            +
                          s.each do |p|
         
     | 
| 
      
 53 
     | 
    
         
            +
                            io.puts p
         
     | 
| 
      
 54 
     | 
    
         
            +
                          end
         
     | 
| 
      
 55 
     | 
    
         
            +
                        end
         
     | 
| 
      
 56 
     | 
    
         
            +
                        return
         
     | 
| 
      
 57 
     | 
    
         
            +
                      end
         
     | 
| 
      
 58 
     | 
    
         
            +
                      # show the list of files.
         
     | 
| 
      
 59 
     | 
    
         
            +
                      gem_spec.files.each do |f|
         
     | 
| 
      
 60 
     | 
    
         
            +
                        io.puts File.join(gem_spec.full_gem_path, f)
         
     | 
| 
      
 61 
     | 
    
         
            +
                      end
         
     | 
| 
      
 62 
     | 
    
         
            +
                    end
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
              end
         
     | 
| 
      
 66 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,105 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Gem
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Commands
         
     | 
| 
      
 3 
     | 
    
         
            +
                class DependencyCommand < Command
         
     | 
| 
      
 4 
     | 
    
         
            +
                  include VersionOption
         
     | 
| 
      
 5 
     | 
    
         
            +
                  include CommandAids
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                  def initialize
         
     | 
| 
      
 8 
     | 
    
         
            +
                    super('dependency',
         
     | 
| 
      
 9 
     | 
    
         
            +
                      'Show the dependencies of an installed gem',
         
     | 
| 
      
 10 
     | 
    
         
            +
                      {:version=>"> 0"})
         
     | 
| 
      
 11 
     | 
    
         
            +
                    add_version_option('dependency')
         
     | 
| 
      
 12 
     | 
    
         
            +
                    add_option('-r', '--[no-]reverse-dependencies',
         
     | 
| 
      
 13 
     | 
    
         
            +
                      'Include reverse dependencies in the output'
         
     | 
| 
      
 14 
     | 
    
         
            +
                      ) do |value, options|
         
     | 
| 
      
 15 
     | 
    
         
            +
                      options[:reverse_dependencies] = value
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
                    add_option('-p', '--pipe', "Pipe Format (name --version ver)") do |value, options|
         
     | 
| 
      
 18 
     | 
    
         
            +
                      options[:pipe_format] = value
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def defaults_str
         
     | 
| 
      
 23 
     | 
    
         
            +
                    "--version '> 0' --no-reverse"
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                
         
     | 
| 
      
 26 
     | 
    
         
            +
                  def usage
         
     | 
| 
      
 27 
     | 
    
         
            +
                    "#{program_name} GEMNAME"
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def arguments
         
     | 
| 
      
 31 
     | 
    
         
            +
                    "GEMNAME   name of gems to show"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 35 
     | 
    
         
            +
                    specs = {}
         
     | 
| 
      
 36 
     | 
    
         
            +
                    srcindex = SourceIndex.from_installed_gems
         
     | 
| 
      
 37 
     | 
    
         
            +
                    options[:args] << '.' if options[:args].empty?
         
     | 
| 
      
 38 
     | 
    
         
            +
                    options[:args].each do |name|
         
     | 
| 
      
 39 
     | 
    
         
            +
                      speclist = srcindex.search(name, options[:version])
         
     | 
| 
      
 40 
     | 
    
         
            +
                      if speclist.empty?
         
     | 
| 
      
 41 
     | 
    
         
            +
                        say "No match found for #{name} (#{options[:version]})"
         
     | 
| 
      
 42 
     | 
    
         
            +
                      else
         
     | 
| 
      
 43 
     | 
    
         
            +
                        speclist.each do |spec|
         
     | 
| 
      
 44 
     | 
    
         
            +
                          specs[spec.full_name] = spec
         
     | 
| 
      
 45 
     | 
    
         
            +
                        end
         
     | 
| 
      
 46 
     | 
    
         
            +
                      end
         
     | 
| 
      
 47 
     | 
    
         
            +
                    end
         
     | 
| 
      
 48 
     | 
    
         
            +
                    reverse = Hash.new { |h, k| h[k] = [] }
         
     | 
| 
      
 49 
     | 
    
         
            +
                    if options[:reverse_dependencies]
         
     | 
| 
      
 50 
     | 
    
         
            +
                      specs.values.each do |spec|
         
     | 
| 
      
 51 
     | 
    
         
            +
                        reverse[spec.full_name] = find_reverse_dependencies(spec, srcindex)
         
     | 
| 
      
 52 
     | 
    
         
            +
                      end
         
     | 
| 
      
 53 
     | 
    
         
            +
                    end
         
     | 
| 
      
 54 
     | 
    
         
            +
                    if options[:pipe_format]
         
     | 
| 
      
 55 
     | 
    
         
            +
                      specs.values.sort.each do |spec|
         
     | 
| 
      
 56 
     | 
    
         
            +
                        unless spec.dependencies.empty?
         
     | 
| 
      
 57 
     | 
    
         
            +
                          spec.dependencies.each do |dep|
         
     | 
| 
      
 58 
     | 
    
         
            +
                            puts "#{dep.name} --version '#{dep.version_requirements}'"
         
     | 
| 
      
 59 
     | 
    
         
            +
                          end
         
     | 
| 
      
 60 
     | 
    
         
            +
                        end
         
     | 
| 
      
 61 
     | 
    
         
            +
                      end     
         
     | 
| 
      
 62 
     | 
    
         
            +
                    else
         
     | 
| 
      
 63 
     | 
    
         
            +
                      response = ''
         
     | 
| 
      
 64 
     | 
    
         
            +
                      specs.values.sort.each do |spec|
         
     | 
| 
      
 65 
     | 
    
         
            +
                        response << print_dependencies(spec)
         
     | 
| 
      
 66 
     | 
    
         
            +
                        unless reverse[spec.full_name].empty?
         
     | 
| 
      
 67 
     | 
    
         
            +
                          response << "  Used by\n"
         
     | 
| 
      
 68 
     | 
    
         
            +
                          reverse[spec.full_name].each do |sp, dep|
         
     | 
| 
      
 69 
     | 
    
         
            +
                            response << "    #{sp} (#{dep})\n"
         
     | 
| 
      
 70 
     | 
    
         
            +
                          end
         
     | 
| 
      
 71 
     | 
    
         
            +
                        end
         
     | 
| 
      
 72 
     | 
    
         
            +
                        response << "\n"
         
     | 
| 
      
 73 
     | 
    
         
            +
                      end
         
     | 
| 
      
 74 
     | 
    
         
            +
                      say response
         
     | 
| 
      
 75 
     | 
    
         
            +
                    end
         
     | 
| 
      
 76 
     | 
    
         
            +
                  end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                  def print_dependencies(spec, level = 0)
         
     | 
| 
      
 79 
     | 
    
         
            +
                    response = ''
         
     | 
| 
      
 80 
     | 
    
         
            +
                    response << '  ' * level + "Gem #{spec.full_name}\n"
         
     | 
| 
      
 81 
     | 
    
         
            +
                    unless spec.dependencies.empty?
         
     | 
| 
      
 82 
     | 
    
         
            +
              #        response << '  ' * level + "  Requires\n"
         
     | 
| 
      
 83 
     | 
    
         
            +
                      spec.dependencies.each do |dep|
         
     | 
| 
      
 84 
     | 
    
         
            +
                        response << '  ' * level + "  #{dep}\n"
         
     | 
| 
      
 85 
     | 
    
         
            +
                      end
         
     | 
| 
      
 86 
     | 
    
         
            +
                    end
         
     | 
| 
      
 87 
     | 
    
         
            +
                    response
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                  # Retuns list of [specification, dep] that are satisfied by spec.
         
     | 
| 
      
 91 
     | 
    
         
            +
                  def find_reverse_dependencies(spec, srcindex)
         
     | 
| 
      
 92 
     | 
    
         
            +
                    result = []
         
     | 
| 
      
 93 
     | 
    
         
            +
                    srcindex.each do |name, sp|
         
     | 
| 
      
 94 
     | 
    
         
            +
                      sp.dependencies.each do |dep|
         
     | 
| 
      
 95 
     | 
    
         
            +
                        if spec.name == dep.name &&
         
     | 
| 
      
 96 
     | 
    
         
            +
                            dep.version_requirements.satisfied_by?(spec.version)
         
     | 
| 
      
 97 
     | 
    
         
            +
                          result << [sp.full_name, dep]
         
     | 
| 
      
 98 
     | 
    
         
            +
                        end
         
     | 
| 
      
 99 
     | 
    
         
            +
                      end
         
     | 
| 
      
 100 
     | 
    
         
            +
                    end
         
     | 
| 
      
 101 
     | 
    
         
            +
                    result
         
     | 
| 
      
 102 
     | 
    
         
            +
                  end
         
     | 
| 
      
 103 
     | 
    
         
            +
                end      
         
     | 
| 
      
 104 
     | 
    
         
            +
              end
         
     | 
| 
      
 105 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Gem
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Commands
         
     | 
| 
      
 3 
     | 
    
         
            +
                class EnvironmentCommand < Command
         
     | 
| 
      
 4 
     | 
    
         
            +
                  include CommandAids
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  def initialize
         
     | 
| 
      
 7 
     | 
    
         
            +
                    super('environment', 'Display information about the RubyGems environment')
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def usage
         
     | 
| 
      
 11 
     | 
    
         
            +
                    "#{program_name} [args]"
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def arguments
         
     | 
| 
      
 15 
     | 
    
         
            +
                    args = <<-EOF
         
     | 
| 
      
 16 
     | 
    
         
            +
                      packageversion  display the package version
         
     | 
| 
      
 17 
     | 
    
         
            +
                      gemdir          display the path where gems are installed
         
     | 
| 
      
 18 
     | 
    
         
            +
                      gempath         display path used to search for gems
         
     | 
| 
      
 19 
     | 
    
         
            +
                      version         display the gem format version
         
     | 
| 
      
 20 
     | 
    
         
            +
                      remotesources   display the remote gem servers
         
     | 
| 
      
 21 
     | 
    
         
            +
                      <omitted>       display everything
         
     | 
| 
      
 22 
     | 
    
         
            +
                    EOF
         
     | 
| 
      
 23 
     | 
    
         
            +
                    return args.gsub(/^\s+/, '')
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 27 
     | 
    
         
            +
                    out = ''
         
     | 
| 
      
 28 
     | 
    
         
            +
                    arg = options[:args][0]
         
     | 
| 
      
 29 
     | 
    
         
            +
                    if begins?("packageversion", arg)
         
     | 
| 
      
 30 
     | 
    
         
            +
                      out = Gem::RubyGemsPackageVersion.to_s
         
     | 
| 
      
 31 
     | 
    
         
            +
                    elsif begins?("version", arg)
         
     | 
| 
      
 32 
     | 
    
         
            +
                      out = Gem::RubyGemsVersion.to_s
         
     | 
| 
      
 33 
     | 
    
         
            +
                    elsif begins?("gemdir", arg)
         
     | 
| 
      
 34 
     | 
    
         
            +
                      out = Gem.dir
         
     | 
| 
      
 35 
     | 
    
         
            +
                    elsif begins?("gempath", arg)
         
     | 
| 
      
 36 
     | 
    
         
            +
                      Gem.path.collect { |p| out << "#{p}\n" }
         
     | 
| 
      
 37 
     | 
    
         
            +
                    elsif begins?("remotesources", arg)
         
     | 
| 
      
 38 
     | 
    
         
            +
                      require 'sources'
         
     | 
| 
      
 39 
     | 
    
         
            +
                      out << Gem.sources.join("\n") << "\n"
         
     | 
| 
      
 40 
     | 
    
         
            +
                    elsif arg
         
     | 
| 
      
 41 
     | 
    
         
            +
                      fail Gem::CommandLineError, "Unknown enviroment option [#{arg}]"
         
     | 
| 
      
 42 
     | 
    
         
            +
                    else
         
     | 
| 
      
 43 
     | 
    
         
            +
                      out = "RubyGems Environment:\n"
         
     | 
| 
      
 44 
     | 
    
         
            +
                      out << "  - VERSION: #{Gem::RubyGemsVersion} (#{Gem::RubyGemsPackageVersion})\n"
         
     | 
| 
      
 45 
     | 
    
         
            +
                      out << "  - INSTALLATION DIRECTORY: #{Gem.dir}\n"
         
     | 
| 
      
 46 
     | 
    
         
            +
                      out << "  - GEM PATH:\n"
         
     | 
| 
      
 47 
     | 
    
         
            +
                      Gem.path.collect { |p| out << "     - #{p}\n" }
         
     | 
| 
      
 48 
     | 
    
         
            +
                      out << "  - REMOTE SOURCES:\n"
         
     | 
| 
      
 49 
     | 
    
         
            +
                      require 'sources'
         
     | 
| 
      
 50 
     | 
    
         
            +
                      Gem.sources.collect do |s|
         
     | 
| 
      
 51 
     | 
    
         
            +
                        out << "     - #{s}\n"
         
     | 
| 
      
 52 
     | 
    
         
            +
                      end
         
     | 
| 
      
 53 
     | 
    
         
            +
                    end
         
     | 
| 
      
 54 
     | 
    
         
            +
                    say out
         
     | 
| 
      
 55 
     | 
    
         
            +
                    true
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
      
 57 
     | 
    
         
            +
                end    
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,82 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Gem
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Commands
         
     | 
| 
      
 3 
     | 
    
         
            +
                class HelpCommand < Command
         
     | 
| 
      
 4 
     | 
    
         
            +
                  include CommandAids
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  def initialize
         
     | 
| 
      
 7 
     | 
    
         
            +
                    super('help', "Provide help on the 'gem' command")
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def usage
         
     | 
| 
      
 11 
     | 
    
         
            +
                    "#{program_name} ARGUMENT"
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def arguments
         
     | 
| 
      
 15 
     | 
    
         
            +
                    args = <<-EOF
         
     | 
| 
      
 16 
     | 
    
         
            +
                      commands      List all 'gem' commands
         
     | 
| 
      
 17 
     | 
    
         
            +
                      examples      Show examples of 'gem' usage
         
     | 
| 
      
 18 
     | 
    
         
            +
                      <command>     Show specific help for <command>
         
     | 
| 
      
 19 
     | 
    
         
            +
                    EOF
         
     | 
| 
      
 20 
     | 
    
         
            +
                    return args.gsub(/^\s+/, '')
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 24 
     | 
    
         
            +
                    arg = options[:args][0]
         
     | 
| 
      
 25 
     | 
    
         
            +
                    if begins?("commands", arg)
         
     | 
| 
      
 26 
     | 
    
         
            +
                      out = []
         
     | 
| 
      
 27 
     | 
    
         
            +
                      out << "GEM commands are:"
         
     | 
| 
      
 28 
     | 
    
         
            +
                      out << nil
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                      margin_width = 4
         
     | 
| 
      
 31 
     | 
    
         
            +
                      desc_width = command_manager.command_names.collect {|n| n.size}.max + 4
         
     | 
| 
      
 32 
     | 
    
         
            +
                      summary_width = 80 - margin_width - desc_width
         
     | 
| 
      
 33 
     | 
    
         
            +
                      wrap_indent = ' ' * (margin_width + desc_width)
         
     | 
| 
      
 34 
     | 
    
         
            +
                      format = "#{' ' * margin_width}%-#{desc_width}s%s"
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                      command_manager.command_names.each do |cmd_name|
         
     | 
| 
      
 37 
     | 
    
         
            +
                        summary = command_manager[cmd_name].summary
         
     | 
| 
      
 38 
     | 
    
         
            +
                        summary = wrap(summary, summary_width).split "\n"
         
     | 
| 
      
 39 
     | 
    
         
            +
                        out << sprintf(format, cmd_name, summary.shift)
         
     | 
| 
      
 40 
     | 
    
         
            +
                        until summary.empty? do
         
     | 
| 
      
 41 
     | 
    
         
            +
                          out << "#{wrap_indent}#{summary.shift}"
         
     | 
| 
      
 42 
     | 
    
         
            +
                        end
         
     | 
| 
      
 43 
     | 
    
         
            +
                      end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                      out << nil
         
     | 
| 
      
 46 
     | 
    
         
            +
                      out << "For help on a particular command, use 'gem help COMMAND'."
         
     | 
| 
      
 47 
     | 
    
         
            +
                      out << nil
         
     | 
| 
      
 48 
     | 
    
         
            +
                      out << "Commands may be abbreviated, so long as they are unambiguous."
         
     | 
| 
      
 49 
     | 
    
         
            +
                      out << "e.g. 'gem i rake' is short for 'gem install rake'."
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                      say out.join("\n")
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                    elsif begins?("options", arg)
         
     | 
| 
      
 54 
     | 
    
         
            +
                      say Gem::HELP
         
     | 
| 
      
 55 
     | 
    
         
            +
                    elsif begins?("examples", arg)
         
     | 
| 
      
 56 
     | 
    
         
            +
                      say Gem::EXAMPLES
         
     | 
| 
      
 57 
     | 
    
         
            +
                    elsif options[:help]
         
     | 
| 
      
 58 
     | 
    
         
            +
                      command = command_manager[options[:help]]
         
     | 
| 
      
 59 
     | 
    
         
            +
                      if command
         
     | 
| 
      
 60 
     | 
    
         
            +
                        # help with provided command
         
     | 
| 
      
 61 
     | 
    
         
            +
                        command.invoke("--help")
         
     | 
| 
      
 62 
     | 
    
         
            +
                      else
         
     | 
| 
      
 63 
     | 
    
         
            +
                        alert_error "Unknown command #{options[:help]}.  Try 'gem help commands'"
         
     | 
| 
      
 64 
     | 
    
         
            +
                      end
         
     | 
| 
      
 65 
     | 
    
         
            +
                    elsif arg
         
     | 
| 
      
 66 
     | 
    
         
            +
                      possibilities = command_manager.find_command_possibilities(arg.downcase)
         
     | 
| 
      
 67 
     | 
    
         
            +
                      if possibilities.size == 1
         
     | 
| 
      
 68 
     | 
    
         
            +
                        command = command_manager[possibilities.first]
         
     | 
| 
      
 69 
     | 
    
         
            +
                        command.invoke("--help")
         
     | 
| 
      
 70 
     | 
    
         
            +
                      elsif possibilities.size > 1
         
     | 
| 
      
 71 
     | 
    
         
            +
                        alert_warning "Ambiguous command #{arg} (#{possibilities.join(', ')})"
         
     | 
| 
      
 72 
     | 
    
         
            +
                      else
         
     | 
| 
      
 73 
     | 
    
         
            +
                        alert_warning "Unknown command #{arg}. Try gem help commands"
         
     | 
| 
      
 74 
     | 
    
         
            +
                      end
         
     | 
| 
      
 75 
     | 
    
         
            +
                    else
         
     | 
| 
      
 76 
     | 
    
         
            +
                      say Gem::HELP
         
     | 
| 
      
 77 
     | 
    
         
            +
                    end
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
                
         
     | 
| 
      
 81 
     | 
    
         
            +
              end
         
     | 
| 
      
 82 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,139 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Gem
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Commands
         
     | 
| 
      
 3 
     | 
    
         
            +
                class InstallCommand < Command
         
     | 
| 
      
 4 
     | 
    
         
            +
                  include CommandAids
         
     | 
| 
      
 5 
     | 
    
         
            +
                  include VersionOption
         
     | 
| 
      
 6 
     | 
    
         
            +
                  include LocalRemoteOptions
         
     | 
| 
      
 7 
     | 
    
         
            +
                  include InstallUpdateOptions
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def initialize
         
     | 
| 
      
 10 
     | 
    
         
            +
                    super(
         
     | 
| 
      
 11 
     | 
    
         
            +
                      'install',
         
     | 
| 
      
 12 
     | 
    
         
            +
                      'Install a gem into the local repository',
         
     | 
| 
      
 13 
     | 
    
         
            +
                      {
         
     | 
| 
      
 14 
     | 
    
         
            +
                        :domain => :both, 
         
     | 
| 
      
 15 
     | 
    
         
            +
                        :generate_rdoc => true,
         
     | 
| 
      
 16 
     | 
    
         
            +
                        :generate_ri   => true,
         
     | 
| 
      
 17 
     | 
    
         
            +
                        :force => false, 
         
     | 
| 
      
 18 
     | 
    
         
            +
                        :test => false, 
         
     | 
| 
      
 19 
     | 
    
         
            +
                        :wrappers => true,
         
     | 
| 
      
 20 
     | 
    
         
            +
                        :version => "> 0",
         
     | 
| 
      
 21 
     | 
    
         
            +
                        :install_dir => Gem.dir,
         
     | 
| 
      
 22 
     | 
    
         
            +
                        :security_policy => nil,
         
     | 
| 
      
 23 
     | 
    
         
            +
                      })
         
     | 
| 
      
 24 
     | 
    
         
            +
                    add_version_option('install')
         
     | 
| 
      
 25 
     | 
    
         
            +
                    add_local_remote_options
         
     | 
| 
      
 26 
     | 
    
         
            +
                    add_install_update_options
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
                
         
     | 
| 
      
 29 
     | 
    
         
            +
                  def usage
         
     | 
| 
      
 30 
     | 
    
         
            +
                    "#{program_name} GEMNAME [options]
         
     | 
| 
      
 31 
     | 
    
         
            +
                 or: #{program_name} GEMNAME [options] -- --build-flags"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  def arguments
         
     | 
| 
      
 35 
     | 
    
         
            +
                    "GEMNAME   name of gem to install"
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                  def defaults_str
         
     | 
| 
      
 39 
     | 
    
         
            +
                    "--both --version '> 0' --rdoc --ri --no-force --no-test\n" +
         
     | 
| 
      
 40 
     | 
    
         
            +
                    "--install-dir #{Gem.dir}"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 44 
     | 
    
         
            +
                    ENV['GEM_PATH'] = options[:install_dir]
         
     | 
| 
      
 45 
     | 
    
         
            +
                    if(options[:args].empty?)
         
     | 
| 
      
 46 
     | 
    
         
            +
                      fail Gem::CommandLineError,
         
     | 
| 
      
 47 
     | 
    
         
            +
                        "Please specify a gem name on the command line (e.g. gem build GEMNAME)"
         
     | 
| 
      
 48 
     | 
    
         
            +
                    end
         
     | 
| 
      
 49 
     | 
    
         
            +
                    options[:args].each do |gem_name|
         
     | 
| 
      
 50 
     | 
    
         
            +
                      if local?
         
     | 
| 
      
 51 
     | 
    
         
            +
                        begin
         
     | 
| 
      
 52 
     | 
    
         
            +
                          entries = []
         
     | 
| 
      
 53 
     | 
    
         
            +
                            if(File.exist?(gem_name) && !File.directory?(gem_name))
         
     | 
| 
      
 54 
     | 
    
         
            +
                              entries << gem_name
         
     | 
| 
      
 55 
     | 
    
         
            +
                            else
         
     | 
| 
      
 56 
     | 
    
         
            +
                              filepattern = gem_name + "*.gem"
         
     | 
| 
      
 57 
     | 
    
         
            +
                              entries = Dir[filepattern] 
         
     | 
| 
      
 58 
     | 
    
         
            +
                            end
         
     | 
| 
      
 59 
     | 
    
         
            +
                            unless entries.size > 0
         
     | 
| 
      
 60 
     | 
    
         
            +
                              if options[:domain] == :local
         
     | 
| 
      
 61 
     | 
    
         
            +
                                alert_error "Local gem file not found: #{filepattern}"
         
     | 
| 
      
 62 
     | 
    
         
            +
                              end
         
     | 
| 
      
 63 
     | 
    
         
            +
                            else
         
     | 
| 
      
 64 
     | 
    
         
            +
                              result = Gem::Installer.new(entries.last, options).install(options[:force],     options[:install_dir])
         
     | 
| 
      
 65 
     | 
    
         
            +
                              installed_gems = [result].flatten
         
     | 
| 
      
 66 
     | 
    
         
            +
                              say "Successfully installed #{installed_gems[0].name}, " +
         
     | 
| 
      
 67 
     | 
    
         
            +
                              "version #{installed_gems[0].version}" if installed_gems
         
     | 
| 
      
 68 
     | 
    
         
            +
                          end
         
     | 
| 
      
 69 
     | 
    
         
            +
                        rescue LocalInstallationError => e
         
     | 
| 
      
 70 
     | 
    
         
            +
                          say " -> Local installation can't proceed: #{e.message}"
         
     | 
| 
      
 71 
     | 
    
         
            +
                        rescue Gem::LoadError => e
         
     | 
| 
      
 72 
     | 
    
         
            +
                          say " -> Local installation can't proceed due to LoadError: #{e.message}"
         
     | 
| 
      
 73 
     | 
    
         
            +
                        rescue Gem::InstallError => e
         
     | 
| 
      
 74 
     | 
    
         
            +
                          raise "Error instaling #{gem_name}:\n\t#{e.message}"
         
     | 
| 
      
 75 
     | 
    
         
            +
                        rescue => e
         
     | 
| 
      
 76 
     | 
    
         
            +
                          # TODO: Fix this handle to allow the error to propagate to
         
     | 
| 
      
 77 
     | 
    
         
            +
                          # the top level handler.  Examine the other errors as
         
     | 
| 
      
 78 
     | 
    
         
            +
                          # well.  This implementation here looks suspicious to me --
         
     | 
| 
      
 79 
     | 
    
         
            +
                          # JimWeirich (4/Jan/05) 
         
     | 
| 
      
 80 
     | 
    
         
            +
                          alert_error "Error installing gem #{gem_name}[.gem]: #{e.message}"
         
     | 
| 
      
 81 
     | 
    
         
            +
                          return
         
     | 
| 
      
 82 
     | 
    
         
            +
                        end
         
     | 
| 
      
 83 
     | 
    
         
            +
                      end
         
     | 
| 
      
 84 
     | 
    
         
            +
                    
         
     | 
| 
      
 85 
     | 
    
         
            +
                      if remote? && installed_gems.nil?
         
     | 
| 
      
 86 
     | 
    
         
            +
                        installer = Gem::RemoteInstaller.new(options)
         
     | 
| 
      
 87 
     | 
    
         
            +
                        installed_gems = installer.install(
         
     | 
| 
      
 88 
     | 
    
         
            +
                          gem_name,
         
     | 
| 
      
 89 
     | 
    
         
            +
                          options[:version],
         
     | 
| 
      
 90 
     | 
    
         
            +
                          options[:force],
         
     | 
| 
      
 91 
     | 
    
         
            +
                          options[:install_dir])
         
     | 
| 
      
 92 
     | 
    
         
            +
                        if installed_gems
         
     | 
| 
      
 93 
     | 
    
         
            +
                          installed_gems.compact!
         
     | 
| 
      
 94 
     | 
    
         
            +
                          installed_gems.each do |spec|
         
     | 
| 
      
 95 
     | 
    
         
            +
                            say "Successfully installed #{spec.full_name}"
         
     | 
| 
      
 96 
     | 
    
         
            +
                          end
         
     | 
| 
      
 97 
     | 
    
         
            +
                        end
         
     | 
| 
      
 98 
     | 
    
         
            +
                      end
         
     | 
| 
      
 99 
     | 
    
         
            +
                    
         
     | 
| 
      
 100 
     | 
    
         
            +
                      unless installed_gems
         
     | 
| 
      
 101 
     | 
    
         
            +
                        alert_error "Could not install a local " +
         
     | 
| 
      
 102 
     | 
    
         
            +
                          "or remote copy of the gem: #{gem_name}"
         
     | 
| 
      
 103 
     | 
    
         
            +
                        terminate_interaction(1)
         
     | 
| 
      
 104 
     | 
    
         
            +
                      end
         
     | 
| 
      
 105 
     | 
    
         
            +
                    
         
     | 
| 
      
 106 
     | 
    
         
            +
                      # NOTE: *All* of the RI documents must be generated first.
         
     | 
| 
      
 107 
     | 
    
         
            +
                      # For some reason, RI docs cannot be generated after any RDoc
         
     | 
| 
      
 108 
     | 
    
         
            +
                      # documents are generated.
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                      if options[:generate_ri]
         
     | 
| 
      
 111 
     | 
    
         
            +
                        installed_gems.each do |gem|
         
     | 
| 
      
 112 
     | 
    
         
            +
                          Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri
         
     | 
| 
      
 113 
     | 
    
         
            +
                        end
         
     | 
| 
      
 114 
     | 
    
         
            +
                      end
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
                      if options[:generate_rdoc]
         
     | 
| 
      
 117 
     | 
    
         
            +
                        installed_gems.each do |gem|
         
     | 
| 
      
 118 
     | 
    
         
            +
                          Gem::DocManager.new(gem, options[:rdoc_args]).generate_rdoc
         
     | 
| 
      
 119 
     | 
    
         
            +
                        end
         
     | 
| 
      
 120 
     | 
    
         
            +
                      end
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                      if options[:test]
         
     | 
| 
      
 123 
     | 
    
         
            +
                        installed_gems.each do |spec|
         
     | 
| 
      
 124 
     | 
    
         
            +
                          gem_spec = Gem::SourceIndex.from_installed_gems.search(spec.name, spec.version.version).first
         
     | 
| 
      
 125 
     | 
    
         
            +
                          result = Gem::Validator.new.unit_test(gem_spec)
         
     | 
| 
      
 126 
     | 
    
         
            +
                          unless result.passed?
         
     | 
| 
      
 127 
     | 
    
         
            +
                            unless ask_yes_no("...keep Gem?", true) then
         
     | 
| 
      
 128 
     | 
    
         
            +
                              Gem::Uninstaller.new(spec.name, spec.version.version).uninstall
         
     | 
| 
      
 129 
     | 
    
         
            +
                            end
         
     | 
| 
      
 130 
     | 
    
         
            +
                          end
         
     | 
| 
      
 131 
     | 
    
         
            +
                        end
         
     | 
| 
      
 132 
     | 
    
         
            +
                      end
         
     | 
| 
      
 133 
     | 
    
         
            +
                    end
         
     | 
| 
      
 134 
     | 
    
         
            +
                  end
         
     | 
| 
      
 135 
     | 
    
         
            +
                
         
     | 
| 
      
 136 
     | 
    
         
            +
                end
         
     | 
| 
      
 137 
     | 
    
         
            +
                
         
     | 
| 
      
 138 
     | 
    
         
            +
              end
         
     | 
| 
      
 139 
     | 
    
         
            +
            end
         
     |