rubygems-update 1.3.6 → 1.3.7
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.tar.gz.sig +0 -0
- data/ChangeLog +86 -0
- data/History.txt +34 -1
- data/Manifest.txt +6 -1
- data/Rakefile +79 -34
- data/lib/rubygems.rb +52 -30
- data/lib/rubygems/builder.rb +2 -0
- data/lib/rubygems/command.rb +12 -0
- data/lib/rubygems/command_manager.rb +17 -12
- data/lib/rubygems/commands/contents_command.rb +1 -1
- data/lib/rubygems/commands/dependency_command.rb +3 -1
- data/lib/rubygems/commands/environment_command.rb +3 -2
- data/lib/rubygems/commands/fetch_command.rb +7 -3
- data/lib/rubygems/commands/install_command.rb +2 -1
- data/lib/rubygems/commands/query_command.rb +16 -3
- data/lib/rubygems/commands/server_command.rb +5 -3
- data/lib/rubygems/commands/setup_command.rb +1 -1
- data/lib/rubygems/commands/unpack_command.rb +35 -23
- data/lib/rubygems/commands/update_command.rb +1 -1
- data/lib/rubygems/defaults.rb +4 -6
- data/lib/rubygems/dependency.rb +32 -6
- data/lib/rubygems/dependency_installer.rb +10 -3
- data/lib/rubygems/doc_manager.rb +5 -2
- data/lib/rubygems/errors.rb +35 -0
- data/lib/rubygems/exceptions.rb +10 -1
- data/lib/rubygems/indexer.rb +1 -1
- data/lib/rubygems/installer.rb +6 -5
- data/lib/rubygems/package.rb +6 -3
- data/lib/rubygems/package/f_sync_dir.rb +4 -3
- data/lib/rubygems/package/tar_header.rb +4 -3
- data/lib/rubygems/package/tar_output.rb +4 -3
- data/lib/rubygems/package/tar_reader.rb +4 -3
- data/lib/rubygems/package/tar_writer.rb +4 -3
- data/lib/rubygems/package_task.rb +4 -3
- data/lib/rubygems/platform.rb +4 -1
- data/lib/rubygems/remote_fetcher.rb +9 -3
- data/lib/rubygems/requirement.rb +5 -0
- data/lib/rubygems/security.rb +3 -3
- data/lib/rubygems/server.rb +33 -18
- data/lib/rubygems/source_index.rb +4 -4
- data/lib/rubygems/source_info_cache.rb +4 -2
- data/lib/rubygems/spec_fetcher.rb +33 -11
- data/lib/rubygems/specification.rb +40 -32
- data/lib/rubygems/test_utilities.rb +2 -2
- data/lib/rubygems/validator.rb +3 -4
- data/lib/rubygems/version.rb +1 -1
- data/test/gem_package_tar_test_case.rb +2 -2
- data/test/gemutilities.rb +15 -9
- data/test/insure_session.rb +1 -1
- data/test/plugin/exception/rubygems_plugin.rb +2 -0
- data/test/plugin/load/rubygems_plugin.rb +1 -0
- data/test/plugin/standarderror/rubygems_plugin.rb +2 -0
- data/test/rubygems/commands/crash_command.rb +5 -0
- data/test/rubygems_plugin.rb +5 -0
- data/test/simple_gem.rb +15 -15
- data/test/test_gem.rb +45 -2
- data/test/test_gem_command_manager.rb +14 -0
- data/test/test_gem_commands_contents_command.rb +7 -5
- data/test/test_gem_commands_environment_command.rb +3 -1
- data/test/test_gem_commands_fetch_command.rb +21 -1
- data/test/test_gem_commands_install_command.rb +2 -4
- data/test/test_gem_commands_query_command.rb +33 -6
- data/test/test_gem_commands_server_command.rb +9 -2
- data/test/test_gem_commands_uninstall_command.rb +4 -2
- data/test/test_gem_commands_unpack_command.rb +46 -2
- data/test/test_gem_config_file.rb +2 -0
- data/test/test_gem_dependency.rb +11 -0
- data/test/test_gem_doc_manager.rb +1 -1
- data/test/test_gem_indexer.rb +2 -2
- data/test/test_gem_installer.rb +1 -1
- data/test/test_gem_package_tar_input.rb +1 -1
- data/test/test_gem_package_tar_writer.rb +3 -3
- data/test/test_gem_platform.rb +19 -0
- data/test/test_gem_server.rb +11 -0
- data/test/test_gem_source_index.rb +2 -2
- data/test/test_gem_spec_fetcher.rb +42 -0
- data/test/test_gem_specification.rb +46 -7
- data/util/{gem_prelude.rb.template → gem_prelude.rb} +53 -23
- metadata +16 -6
- metadata.gz.sig +0 -0
    
        data/lib/rubygems/builder.rb
    CHANGED
    
    
    
        data/lib/rubygems/command.rb
    CHANGED
    
    | @@ -145,6 +145,18 @@ class Gem::Command | |
| 145 145 | 
             
                raise Gem::Exception, "generic command has no actions"
         | 
| 146 146 | 
             
              end
         | 
| 147 147 |  | 
| 148 | 
            +
              ##
         | 
| 149 | 
            +
              #
         | 
| 150 | 
            +
              # Display to the user that a gem couldn't be found and reasons why
         | 
| 151 | 
            +
              def show_lookup_failure(gem_name, version, errors=nil)
         | 
| 152 | 
            +
                if errors and !errors.empty?
         | 
| 153 | 
            +
                  alert_error "Could not find a valid gem '#{gem_name}' (#{version}), here is why:"
         | 
| 154 | 
            +
                  errors.each { |x| say "          #{x.wordy}" }
         | 
| 155 | 
            +
                else
         | 
| 156 | 
            +
                  alert_error "Could not find a valid gem '#{gem_name}' (#{version}) in any repository"
         | 
| 157 | 
            +
                end
         | 
| 158 | 
            +
              end
         | 
| 159 | 
            +
             | 
| 148 160 | 
             
              ##
         | 
| 149 161 | 
             
              # Get all gem names from the command line.
         | 
| 150 162 |  | 
| @@ -75,10 +75,10 @@ class Gem::CommandManager | |
| 75 75 | 
             
              end
         | 
| 76 76 |  | 
| 77 77 | 
             
              ##
         | 
| 78 | 
            -
              # Register the command  | 
| 78 | 
            +
              # Register the Symbol +command+ as a gem command.
         | 
| 79 79 |  | 
| 80 | 
            -
              def register_command( | 
| 81 | 
            -
                @commands[ | 
| 80 | 
            +
              def register_command(command)
         | 
| 81 | 
            +
                @commands[command] = false
         | 
| 82 82 | 
             
              end
         | 
| 83 83 |  | 
| 84 84 | 
             
              ##
         | 
| @@ -123,7 +123,7 @@ class Gem::CommandManager | |
| 123 123 | 
             
                  say Gem::Command::HELP
         | 
| 124 124 | 
             
                  terminate_interaction(0)
         | 
| 125 125 | 
             
                when '-v', '--version'
         | 
| 126 | 
            -
                  say Gem:: | 
| 126 | 
            +
                  say Gem::VERSION
         | 
| 127 127 | 
             
                  terminate_interaction(0)
         | 
| 128 128 | 
             
                when /^-/
         | 
| 129 129 | 
             
                  alert_error "Invalid option: #{args[0]}.  See 'gem --help'."
         | 
| @@ -156,20 +156,25 @@ class Gem::CommandManager | |
| 156 156 |  | 
| 157 157 | 
             
              def load_and_instantiate(command_name)
         | 
| 158 158 | 
             
                command_name = command_name.to_s
         | 
| 159 | 
            +
                const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase } << "Command"
         | 
| 160 | 
            +
                commands = Gem::Commands
         | 
| 159 161 | 
             
                retried = false
         | 
| 160 162 |  | 
| 161 163 | 
             
                begin
         | 
| 162 | 
            -
                   | 
| 163 | 
            -
                  Gem::Commands.const_get("#{const_name}Command").new
         | 
| 164 | 
            +
                  commands.const_get const_name
         | 
| 164 165 | 
             
                rescue NameError
         | 
| 165 | 
            -
                  if retried | 
| 166 | 
            -
             | 
| 167 | 
            -
                   | 
| 168 | 
            -
             | 
| 166 | 
            +
                  raise if retried
         | 
| 167 | 
            +
             | 
| 168 | 
            +
                  retried = true
         | 
| 169 | 
            +
                  begin
         | 
| 169 170 | 
             
                    require "rubygems/commands/#{command_name}_command"
         | 
| 170 | 
            -
             | 
| 171 | 
            +
                  rescue Exception => e
         | 
| 172 | 
            +
                    alert_error "Loading command: #{command_name} (#{e.class})\n    #{e}"
         | 
| 173 | 
            +
                    ui.errs.puts "\t#{e.backtrace.join "\n\t"}" if
         | 
| 174 | 
            +
                      Gem.configuration.backtrace
         | 
| 171 175 | 
             
                  end
         | 
| 172 | 
            -
             | 
| 176 | 
            +
                  retry
         | 
| 177 | 
            +
                end.new
         | 
| 173 178 | 
             
              end
         | 
| 174 179 |  | 
| 175 180 | 
             
            end
         | 
| @@ -159,7 +159,9 @@ class Gem::Commands::DependencyCommand < Gem::Command | |
| 159 159 | 
             
                response
         | 
| 160 160 | 
             
              end
         | 
| 161 161 |  | 
| 162 | 
            -
               | 
| 162 | 
            +
              ##
         | 
| 163 | 
            +
              # Returns an Array of [specification, dep] that are satisfied by +spec+.
         | 
| 164 | 
            +
             | 
| 163 165 | 
             
              def find_reverse_dependencies(spec)
         | 
| 164 166 | 
             
                result = []
         | 
| 165 167 |  | 
| @@ -69,7 +69,7 @@ lib/rubygems/defaults/operating_system.rb | |
| 69 69 | 
             
                when /^packageversion/ then
         | 
| 70 70 | 
             
                  out << Gem::RubyGemsPackageVersion
         | 
| 71 71 | 
             
                when /^version/ then
         | 
| 72 | 
            -
                  out << Gem:: | 
| 72 | 
            +
                  out << Gem::VERSION
         | 
| 73 73 | 
             
                when /^gemdir/, /^gemhome/, /^home/, /^GEM_HOME/ then
         | 
| 74 74 | 
             
                  out << Gem.dir
         | 
| 75 75 | 
             
                when /^gempath/, /^path/, /^GEM_PATH/ then
         | 
| @@ -79,7 +79,7 @@ lib/rubygems/defaults/operating_system.rb | |
| 79 79 | 
             
                when nil then
         | 
| 80 80 | 
             
                  out = "RubyGems Environment:\n"
         | 
| 81 81 |  | 
| 82 | 
            -
                  out << "  - RUBYGEMS VERSION: #{Gem:: | 
| 82 | 
            +
                  out << "  - RUBYGEMS VERSION: #{Gem::VERSION}\n"
         | 
| 83 83 |  | 
| 84 84 | 
             
                  out << "  - RUBY VERSION: #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
         | 
| 85 85 | 
             
                  out << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
         | 
| @@ -109,6 +109,7 @@ lib/rubygems/defaults/operating_system.rb | |
| 109 109 |  | 
| 110 110 | 
             
                  out << "  - GEM CONFIGURATION:\n"
         | 
| 111 111 | 
             
                  Gem.configuration.each do |name, value|
         | 
| 112 | 
            +
                    value = value.gsub(/./, '*') if name == 'gemcutter_key'
         | 
| 112 113 | 
             
                    out << "     - #{name.inspect} => #{value.inspect}\n"
         | 
| 113 114 | 
             
                  end
         | 
| 114 115 |  | 
| @@ -34,7 +34,7 @@ class Gem::Commands::FetchCommand < Gem::Command | |
| 34 34 |  | 
| 35 35 | 
             
              def execute
         | 
| 36 36 | 
             
                version = options[:version] || Gem::Requirement.default
         | 
| 37 | 
            -
                all = Gem::Requirement.default
         | 
| 37 | 
            +
                all = Gem::Requirement.default != version
         | 
| 38 38 |  | 
| 39 39 | 
             
                gem_names = get_all_gem_names
         | 
| 40 40 |  | 
| @@ -42,13 +42,17 @@ class Gem::Commands::FetchCommand < Gem::Command | |
| 42 42 | 
             
                  dep = Gem::Dependency.new gem_name, version
         | 
| 43 43 | 
             
                  dep.prerelease = options[:prerelease]
         | 
| 44 44 |  | 
| 45 | 
            -
                  specs_and_sources = Gem::SpecFetcher.fetcher.fetch(dep,  | 
| 45 | 
            +
                  specs_and_sources = Gem::SpecFetcher.fetcher.fetch(dep, all, true,
         | 
| 46 46 | 
             
                                                                     dep.prerelease?)
         | 
| 47 47 |  | 
| 48 | 
            +
                  specs_and_sources, errors =
         | 
| 49 | 
            +
                    Gem::SpecFetcher.fetcher.fetch_with_errors(dep, all, true,
         | 
| 50 | 
            +
                                                               dep.prerelease?)
         | 
| 51 | 
            +
             | 
| 48 52 | 
             
                  spec, source_uri = specs_and_sources.sort_by { |s,| s.version }.last
         | 
| 49 53 |  | 
| 50 54 | 
             
                  if spec.nil? then
         | 
| 51 | 
            -
                     | 
| 55 | 
            +
                    show_lookup_failure gem_name, version, errors
         | 
| 52 56 | 
             
                    next
         | 
| 53 57 | 
             
                  end
         | 
| 54 58 |  | 
| @@ -127,7 +127,8 @@ to write the specification by hand.  For example: | |
| 127 127 | 
             
                    alert_error "Error installing #{gem_name}:\n\t#{e.message}"
         | 
| 128 128 | 
             
                    exit_code |= 1
         | 
| 129 129 | 
             
                  rescue Gem::GemNotFoundException => e
         | 
| 130 | 
            -
                     | 
| 130 | 
            +
                    show_lookup_failure e.name, e.version, e.errors
         | 
| 131 | 
            +
             | 
| 131 132 | 
             
                    exit_code |= 2
         | 
| 132 133 | 
             
                  end
         | 
| 133 134 | 
             
                end
         | 
| @@ -21,7 +21,7 @@ class Gem::Commands::QueryCommand < Gem::Command | |
| 21 21 | 
             
                  options[:installed] = value
         | 
| 22 22 | 
             
                end
         | 
| 23 23 |  | 
| 24 | 
            -
                add_version_option
         | 
| 24 | 
            +
                add_version_option command, "for use with --installed"
         | 
| 25 25 |  | 
| 26 26 | 
             
                add_option('-n', '--name-matches REGEXP',
         | 
| 27 27 | 
             
                           'Name of gem(s) to query on matches the',
         | 
| @@ -185,8 +185,21 @@ class Gem::Commands::QueryCommand < Gem::Command | |
| 185 185 | 
             
                  entry = gem_name.dup
         | 
| 186 186 |  | 
| 187 187 | 
             
                  if options[:versions] then
         | 
| 188 | 
            -
                     | 
| 189 | 
            -
             | 
| 188 | 
            +
                    list = if platforms.empty? or options[:details] then
         | 
| 189 | 
            +
                             matching_tuples.map { |(name, version,_),_| version }.uniq
         | 
| 190 | 
            +
                           else
         | 
| 191 | 
            +
                             platforms.sort.reverse.map do |version, pls|
         | 
| 192 | 
            +
                               if pls == [Gem::Platform::RUBY] then
         | 
| 193 | 
            +
                                 version
         | 
| 194 | 
            +
                               else
         | 
| 195 | 
            +
                                 ruby = pls.delete Gem::Platform::RUBY
         | 
| 196 | 
            +
                                 platform_list = [ruby, *pls.sort].compact
         | 
| 197 | 
            +
                                 "#{version} #{platform_list.join ' '}"
         | 
| 198 | 
            +
                               end
         | 
| 199 | 
            +
                             end
         | 
| 200 | 
            +
                           end.join ', '
         | 
| 201 | 
            +
             | 
| 202 | 
            +
                    entry << " (#{list})"
         | 
| 190 203 | 
             
                  end
         | 
| 191 204 |  | 
| 192 205 | 
             
                  if options[:details] then
         | 
| @@ -5,7 +5,7 @@ class Gem::Commands::ServerCommand < Gem::Command | |
| 5 5 |  | 
| 6 6 | 
             
              def initialize
         | 
| 7 7 | 
             
                super 'server', 'Documentation and gem repository HTTP server',
         | 
| 8 | 
            -
                      :port => 8808, :gemdir =>  | 
| 8 | 
            +
                      :port => 8808, :gemdir => [], :daemon => false
         | 
| 9 9 |  | 
| 10 10 | 
             
                OptionParser.accept :Port do |port|
         | 
| 11 11 | 
             
                  if port =~ /\A\d+\z/ then
         | 
| @@ -29,8 +29,9 @@ class Gem::Commands::ServerCommand < Gem::Command | |
| 29 29 | 
             
                end
         | 
| 30 30 |  | 
| 31 31 | 
             
                add_option '-d', '--dir=GEMDIR',
         | 
| 32 | 
            -
                           ' | 
| 33 | 
            -
             | 
| 32 | 
            +
                           'directories from which to serve gems',
         | 
| 33 | 
            +
                           'multiple directories may be provided' do |gemdir, options|
         | 
| 34 | 
            +
                  options[:gemdir] << File.expand_path(gemdir)
         | 
| 34 35 | 
             
                end
         | 
| 35 36 |  | 
| 36 37 | 
             
                add_option '--[no-]daemon', 'run as a daemon' do |daemon, options|
         | 
| @@ -69,6 +70,7 @@ You can set up a shortcut to gem server documentation using the URL: | |
| 69 70 | 
             
              end
         | 
| 70 71 |  | 
| 71 72 | 
             
              def execute
         | 
| 73 | 
            +
                options[:gemdir] << Gem.dir if options[:gemdir].empty?
         | 
| 72 74 | 
             
                Gem::Server.run options
         | 
| 73 75 | 
             
              end
         | 
| 74 76 |  | 
| @@ -231,7 +231,7 @@ TEXT | |
| 231 231 |  | 
| 232 232 | 
             
              def install_rdoc
         | 
| 233 233 | 
             
                gem_doc_dir = File.join Gem.dir, 'doc'
         | 
| 234 | 
            -
                rubygems_name = "rubygems-#{Gem:: | 
| 234 | 
            +
                rubygems_name = "rubygems-#{Gem::VERSION}"
         | 
| 235 235 | 
             
                rubygems_doc_dir = File.join gem_doc_dir, rubygems_name
         | 
| 236 236 |  | 
| 237 237 | 
             
                if File.writable? gem_doc_dir and
         | 
| @@ -12,7 +12,8 @@ class Gem::Commands::UnpackCommand < Gem::Command | |
| 12 12 | 
             
                      :version => Gem::Requirement.default,
         | 
| 13 13 | 
             
                      :target  => Dir.pwd
         | 
| 14 14 |  | 
| 15 | 
            -
                add_option('--target=DIR', | 
| 15 | 
            +
                add_option('--target=DIR',
         | 
| 16 | 
            +
                           'target directory for unpacking') do |value, options|
         | 
| 16 17 | 
             
                  options[:target] = value
         | 
| 17 18 | 
             
                end
         | 
| 18 19 |  | 
| @@ -31,6 +32,16 @@ class Gem::Commands::UnpackCommand < Gem::Command | |
| 31 32 | 
             
                "#{program_name} GEMNAME"
         | 
| 32 33 | 
             
              end
         | 
| 33 34 |  | 
| 35 | 
            +
              def download dependency
         | 
| 36 | 
            +
                found = Gem::SpecFetcher.fetcher.fetch dependency
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                return if found.empty?
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                spec, source_uri = found.first
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                Gem::RemoteFetcher.fetcher.download spec, source_uri
         | 
| 43 | 
            +
              end
         | 
| 44 | 
            +
             | 
| 34 45 | 
             
              #--
         | 
| 35 46 | 
             
              # TODO: allow, e.g., 'gem unpack rake-0.3.1'.  Find a general solution for
         | 
| 36 47 | 
             
              # this, so that it works for uninstall as well.  (And check other commands
         | 
| @@ -38,11 +49,12 @@ class Gem::Commands::UnpackCommand < Gem::Command | |
| 38 49 |  | 
| 39 50 | 
             
              def execute
         | 
| 40 51 | 
             
                get_all_gem_names.each do |name|
         | 
| 41 | 
            -
                   | 
| 52 | 
            +
                  dependency = Gem::Dependency.new name, options[:version]
         | 
| 53 | 
            +
                  path = get_path dependency
         | 
| 42 54 |  | 
| 43 55 | 
             
                  if path then
         | 
| 44 | 
            -
                    basename = File.basename | 
| 45 | 
            -
                    target_dir = File.expand_path  | 
| 56 | 
            +
                    basename = File.basename path, '.gem'
         | 
| 57 | 
            +
                    target_dir = File.expand_path basename, options[:target]
         | 
| 46 58 | 
             
                    FileUtils.mkdir_p target_dir
         | 
| 47 59 | 
             
                    Gem::Installer.new(path, :unpack => true).unpack target_dir
         | 
| 48 60 | 
             
                    say "Unpacked gem: '#{target_dir}'"
         | 
| @@ -52,14 +64,15 @@ class Gem::Commands::UnpackCommand < Gem::Command | |
| 52 64 | 
             
                end
         | 
| 53 65 | 
             
              end
         | 
| 54 66 |  | 
| 67 | 
            +
              ##
         | 
| 55 68 | 
             
              # Return the full path to the cached gem file matching the given
         | 
| 56 69 | 
             
              # name and version requirement.  Returns 'nil' if no match.
         | 
| 57 70 | 
             
              #
         | 
| 58 71 | 
             
              # Example:
         | 
| 59 72 | 
             
              #
         | 
| 60 | 
            -
              #   get_path | 
| 61 | 
            -
              #   get_path | 
| 62 | 
            -
              #   get_path | 
| 73 | 
            +
              #   get_path 'rake', '> 0.4' # "/usr/lib/ruby/gems/1.8/cache/rake-0.4.2.gem"
         | 
| 74 | 
            +
              #   get_path 'rake', '< 0.1' # nil
         | 
| 75 | 
            +
              #   get_path 'rak'           # nil (exact name required)
         | 
| 63 76 | 
             
              #--
         | 
| 64 77 | 
             
              # TODO: This should be refactored so that it's a general service. I don't
         | 
| 65 78 | 
             
              # think any of our existing classes are the right place though.  Just maybe
         | 
| @@ -67,30 +80,29 @@ class Gem::Commands::UnpackCommand < Gem::Command | |
| 67 80 | 
             
              #
         | 
| 68 81 | 
             
              # TODO: It just uses Gem.dir for now.  What's an easy way to get the list of
         | 
| 69 82 | 
             
              # source directories?
         | 
| 70 | 
            -
              def get_path(gemname, version_req)
         | 
| 71 | 
            -
                return gemname if gemname =~ /\.gem$/i
         | 
| 72 83 |  | 
| 73 | 
            -
             | 
| 84 | 
            +
              def get_path dependency
         | 
| 85 | 
            +
                return dependency.name if dependency.name =~ /\.gem$/i
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                specs = Gem.source_index.search dependency
         | 
| 74 88 |  | 
| 75 89 | 
             
                selected = specs.sort_by { |s| s.version }.last
         | 
| 76 90 |  | 
| 77 | 
            -
                return  | 
| 91 | 
            +
                return download(dependency) if selected.nil?
         | 
| 78 92 |  | 
| 79 | 
            -
                 | 
| 80 | 
            -
                # Furthermore, the name match must be exact (ignoring case).
         | 
| 81 | 
            -
                if gemname =~ /^#{selected.name}$/i
         | 
| 82 | 
            -
                  filename = selected.file_name
         | 
| 83 | 
            -
                  path = nil
         | 
| 93 | 
            +
                return unless dependency.name =~ /^#{selected.name}$/i
         | 
| 84 94 |  | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 95 | 
            +
                # We expect to find (basename).gem in the 'cache' directory.  Furthermore,
         | 
| 96 | 
            +
                # the name match must be exact (ignoring case).
         | 
| 97 | 
            +
                filename = selected.file_name
         | 
| 98 | 
            +
                path = nil
         | 
| 89 99 |  | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
                   | 
| 100 | 
            +
                Gem.path.find do |gem_dir|
         | 
| 101 | 
            +
                  path = File.join gem_dir, 'cache', filename
         | 
| 102 | 
            +
                  File.exist? path
         | 
| 93 103 | 
             
                end
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                path
         | 
| 94 106 | 
             
              end
         | 
| 95 107 |  | 
| 96 108 | 
             
            end
         | 
| @@ -56,7 +56,7 @@ class Gem::Commands::UpdateCommand < Gem::Command | |
| 56 56 |  | 
| 57 57 | 
             
                  rubygems_update = Gem::Specification.new
         | 
| 58 58 | 
             
                  rubygems_update.name = 'rubygems-update'
         | 
| 59 | 
            -
                  rubygems_update.version = Gem::Version.new Gem:: | 
| 59 | 
            +
                  rubygems_update.version = Gem::Version.new Gem::VERSION
         | 
| 60 60 | 
             
                  hig['rubygems-update'] = rubygems_update
         | 
| 61 61 |  | 
| 62 62 | 
             
                  options[:user_install] = false
         | 
    
        data/lib/rubygems/defaults.rb
    CHANGED
    
    | @@ -20,9 +20,8 @@ module Gem | |
| 20 20 | 
             
                if defined? RUBY_FRAMEWORK_VERSION then
         | 
| 21 21 | 
             
                  File.join File.dirname(ConfigMap[:sitedir]), 'Gems',
         | 
| 22 22 | 
             
                            ConfigMap[:ruby_version]
         | 
| 23 | 
            -
                 | 
| 24 | 
            -
             | 
| 25 | 
            -
                  File.join(ConfigMap[:libdir], ConfigMap[:ruby_install_name], 'gems',
         | 
| 23 | 
            +
                elsif ConfigMap[:rubylibprefix] then
         | 
| 24 | 
            +
                  File.join(ConfigMap[:rubylibprefix], 'gems',
         | 
| 26 25 | 
             
                            ConfigMap[:ruby_version])
         | 
| 27 26 | 
             
                else
         | 
| 28 27 | 
             
                  File.join(ConfigMap[:libdir], ruby_engine, 'gems',
         | 
| @@ -34,15 +33,14 @@ module Gem | |
| 34 33 | 
             
              # Path for gems in the user's home directory
         | 
| 35 34 |  | 
| 36 35 | 
             
              def self.user_dir
         | 
| 37 | 
            -
                File.join | 
| 38 | 
            -
                          ConfigMap[:ruby_version])
         | 
| 36 | 
            +
                File.join Gem.user_home, '.gem', ruby_engine, ConfigMap[:ruby_version]
         | 
| 39 37 | 
             
              end
         | 
| 40 38 |  | 
| 41 39 | 
             
              ##
         | 
| 42 40 | 
             
              # Default gem load path
         | 
| 43 41 |  | 
| 44 42 | 
             
              def self.default_path
         | 
| 45 | 
            -
                if File.exist? | 
| 43 | 
            +
                if File.exist? Gem.user_home then
         | 
| 46 44 | 
             
                  [user_dir, default_dir]
         | 
| 47 45 | 
             
                else
         | 
| 48 46 | 
             
                  [default_dir]
         | 
    
        data/lib/rubygems/dependency.rb
    CHANGED
    
    | @@ -68,9 +68,6 @@ class Gem::Dependency | |
| 68 68 | 
             
                @version_requirements = @requirement
         | 
| 69 69 | 
             
              end
         | 
| 70 70 |  | 
| 71 | 
            -
              ##
         | 
| 72 | 
            -
              # What does this dependency require?
         | 
| 73 | 
            -
             | 
| 74 71 | 
             
              ##
         | 
| 75 72 | 
             
              # A dependency's hash is the XOR of the hashes of +name+, +type+,
         | 
| 76 73 | 
             
              # and +requirement+.
         | 
| @@ -106,6 +103,9 @@ class Gem::Dependency | |
| 106 103 | 
             
                end
         | 
| 107 104 | 
             
              end
         | 
| 108 105 |  | 
| 106 | 
            +
              ##
         | 
| 107 | 
            +
              # What does this dependency require?
         | 
| 108 | 
            +
             | 
| 109 109 | 
             
              def requirement
         | 
| 110 110 | 
             
                return @requirement if defined?(@requirement) and @requirement
         | 
| 111 111 |  | 
| @@ -160,7 +160,16 @@ class Gem::Dependency | |
| 160 160 | 
             
                __requirement
         | 
| 161 161 | 
             
              end
         | 
| 162 162 |  | 
| 163 | 
            -
               | 
| 163 | 
            +
              alias version_requirement version_requirements # :nodoc:
         | 
| 164 | 
            +
             | 
| 165 | 
            +
              def version_requirements= requirements # :nodoc:
         | 
| 166 | 
            +
                warn "#{Gem.location_of_caller.join ':'}:Warning: " \
         | 
| 167 | 
            +
                     "Gem::Dependency#version_requirements= is deprecated " \
         | 
| 168 | 
            +
                     "and will be removed on or after August 2010.  " \
         | 
| 169 | 
            +
                     "Use Gem::Dependency.new."
         | 
| 170 | 
            +
             | 
| 171 | 
            +
                @requirement = Gem::Requirement.create requirements
         | 
| 172 | 
            +
              end
         | 
| 164 173 |  | 
| 165 174 | 
             
              def == other # :nodoc:
         | 
| 166 175 | 
             
                Gem::Dependency === other &&
         | 
| @@ -188,9 +197,12 @@ class Gem::Dependency | |
| 188 197 | 
             
                end
         | 
| 189 198 |  | 
| 190 199 | 
             
                pattern = name
         | 
| 191 | 
            -
                pattern = /\A#{Regexp.escape pattern}\Z/ unless Regexp === pattern
         | 
| 192 200 |  | 
| 193 | 
            -
                 | 
| 201 | 
            +
                if Regexp === pattern then
         | 
| 202 | 
            +
                  return false unless pattern =~ other.name
         | 
| 203 | 
            +
                else
         | 
| 204 | 
            +
                  return false unless pattern == other.name
         | 
| 205 | 
            +
                end
         | 
| 194 206 |  | 
| 195 207 | 
             
                reqs = other.requirement.requirements
         | 
| 196 208 |  | 
| @@ -202,5 +214,19 @@ class Gem::Dependency | |
| 202 214 | 
             
                requirement.satisfied_by? version
         | 
| 203 215 | 
             
              end
         | 
| 204 216 |  | 
| 217 | 
            +
              def match?(spec_name, spec_version)
         | 
| 218 | 
            +
                pattern = name
         | 
| 219 | 
            +
             | 
| 220 | 
            +
                if Regexp === pattern
         | 
| 221 | 
            +
                  return false unless pattern =~ spec_name
         | 
| 222 | 
            +
                else
         | 
| 223 | 
            +
                  return false unless pattern == spec_name
         | 
| 224 | 
            +
                end
         | 
| 225 | 
            +
             | 
| 226 | 
            +
                return true if requirement.none?
         | 
| 227 | 
            +
             | 
| 228 | 
            +
                requirement.satisfied_by? Gem::Version.new(spec_version)
         | 
| 229 | 
            +
              end
         | 
| 230 | 
            +
             | 
| 205 231 | 
             
            end
         | 
| 206 232 |  |