[前][次][番号順一覧][スレッド一覧]

ruby-changes:3933

From: ko1@a...
Date: Sun, 10 Feb 2008 17:00:51 +0900 (JST)
Subject: [ruby-changes:3933] drbrain - Ruby:r15423 (trunk): Import RubyGems r1601. .

drbrain	2008-02-10 17:00:19 +0900 (Sun, 10 Feb 2008)

  New Revision: 15423

  Modified files:
    trunk/ChangeLog
    trunk/bin/gem
    trunk/gem_prelude.rb
    trunk/lib/rubygems/command.rb
    trunk/lib/rubygems/commands/environment_command.rb
    trunk/lib/rubygems/commands/uninstall_command.rb
    trunk/lib/rubygems/exceptions.rb
    trunk/lib/rubygems/install_update_options.rb
    trunk/lib/rubygems/installer.rb
    trunk/lib/rubygems/package.rb
    trunk/lib/rubygems/source_index.rb
    trunk/lib/rubygems/specification.rb
    trunk/lib/rubygems/uninstaller.rb
    trunk/lib/rubygems/user_interaction.rb
    trunk/lib/rubygems.rb
    trunk/test/rubygems/test_gem.rb
    trunk/test/rubygems/test_gem_commands_cert_command.rb
    trunk/test/rubygems/test_gem_commands_environment_command.rb
    trunk/test/rubygems/test_gem_commands_fetch_command.rb
    trunk/test/rubygems/test_gem_commands_specification_command.rb
    trunk/test/rubygems/test_gem_dependency_installer.rb
    trunk/test/rubygems/test_gem_remote_fetcher.rb
    trunk/test/rubygems/test_gem_server.rb
    trunk/test/rubygems/test_gem_source_index.rb
    trunk/test/rubygems/test_gem_version.rb
    trunk/test/rubygems/test_kernel.rb

  Log:
    Import RubyGems r1601.  [ruby-core:15381].

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/commands/uninstall_command.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_gem_commands_environment_command.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_gem_source_index.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_gem_remote_fetcher.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_gem_commands_specification_command.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_gem.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/user_interaction.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/installer.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_kernel.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/source_index.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/package.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/commands/environment_command.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_gem_commands_fetch_command.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_gem_commands_cert_command.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/uninstaller.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bin/gem?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_gem_server.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/gem_prelude.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/specification.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/exceptions.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_gem_version.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/command.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rubygems/test_gem_dependency_installer.rb?r1=15423&r2=15422&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rubygems/install_update_options.rb?r1=15423&r2=15422&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15422)
+++ ChangeLog	(revision 15423)
@@ -1,3 +1,8 @@
+Sun Feb 10 16:58:20 2008  Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems*, test/rubygems*, gem_prelude.rb: Import RubyGems
+	* r1601.  [ruby-core:15381]
+
 Sun Feb 10 15:07:23 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* {bcc32,win32,wince}/Makefile.sub (MISSING): added cbrt.obj.
Index: gem_prelude.rb
===================================================================
--- gem_prelude.rb	(revision 15422)
+++ gem_prelude.rb	(revision 15423)
@@ -166,7 +166,13 @@
           require_paths << File.join(path, "lib") if File.exist?(File.join(path, "lib"))
         end
       end
-
+      
+      # "tag" the first require_path inserted into the $LOAD_PATH to enable
+      # indexing correctly with rubygems proper when it inserts an explicitly
+      # gem version
+      unless require_paths.empty?
+        require_paths.first.instance_variable_set(:@gem_prelude_index, true)
+      end
       # gem directories must come after -I and ENV['RUBYLIB']
       $:[$:.index(ConfigMap[:sitelibdir]),0] = require_paths
     end
Index: lib/rubygems/user_interaction.rb
===================================================================
--- lib/rubygems/user_interaction.rb	(revision 15422)
+++ lib/rubygems/user_interaction.rb	(revision 15423)
@@ -75,7 +75,7 @@
           ui.#{methname}(*args)
         end
       }
-    end    
+    end
   end
 
   ####################################################################
Index: lib/rubygems/command.rb
===================================================================
--- lib/rubygems/command.rb	(revision 15422)
+++ lib/rubygems/command.rb	(revision 15423)
@@ -136,7 +136,7 @@
         execute
       end
     end
-    
+
     # Call the given block when invoked.
     #
     # Normal command invocations just executes the +execute+ method of
@@ -146,7 +146,7 @@
     def when_invoked(&block)
       @when_invoked = block
     end
-    
+
     # Add a command-line option and handler to the command.
     #
     # See OptionParser#make_switch for an explanation of +opts+.
@@ -165,7 +165,7 @@
         option_list.reject! { |args, _| args.any? { |x| x =~ /^#{name}/ } }
       end
     end
-    
+
     # Merge a set of command options with the set of default options
     # (without modifying the default option hash).
     def merge_options(new_options)
@@ -191,7 +191,7 @@
       parser.parse!(args)
       @options[:args] = args
     end
-    
+
     def add_extra_args(args)
       result = []
       s_extra = Command.specific_extra_args(@command)
@@ -291,7 +291,7 @@
       def common_options
         @common_options ||= []
       end
-    
+
       def add_common_option(*args, &handler)
         Gem::Command.common_options << [args, handler]
       end
@@ -315,7 +315,7 @@
       def specific_extra_args(cmd)
         specific_extra_args_hash[cmd]
       end
-      
+
       # Add a list of extra arguments for the given command.  +args+
       # may be an array or a string to be split on white space.
       def add_specific_extra_args(cmd,args)
@@ -334,7 +334,7 @@
     # ----------------------------------------------------------------
     # Add the options common to all commands.
 
-    add_common_option('-h', '--help', 
+    add_common_option('-h', '--help',
       'Get help on this command') do
       |value, options|
       options[:help] = true
@@ -358,11 +358,11 @@
     # commands.  Both options are actually handled before the other
     # options get parsed.
 
-    add_common_option('--config-file FILE', 
+    add_common_option('--config-file FILE',
       "Use this config file instead of default") do
     end
 
-    add_common_option('--backtrace', 
+    add_common_option('--backtrace',
       'Show stack backtrace on errors') do
     end
 
Index: lib/rubygems/install_update_options.rb
===================================================================
--- lib/rubygems/install_update_options.rb	(revision 15422)
+++ lib/rubygems/install_update_options.rb	(revision 15423)
@@ -37,7 +37,7 @@
       options[:generate_ri] = value
     end
 
-    add_option(:"Install/Update", '-E', '--env-shebang',
+    add_option(:"Install/Update", '-E', '--[no-]env-shebang',
                "Rewrite the shebang line on installed",
                "scripts to use /usr/bin/env") do |value, options|
       options[:env_shebang] = value
Index: lib/rubygems/specification.rb
===================================================================
--- lib/rubygems/specification.rb	(revision 15422)
+++ lib/rubygems/specification.rb	(revision 15423)
@@ -457,7 +457,7 @@
 
     overwrite_accessor :default_executable do
       begin
-        if defined? @default_executable and @default_executable
+        if defined?(@default_executable) and @default_executable
           result = @default_executable
         elsif @executables and @executables.size == 1
           result = Array(@executables).first
@@ -471,14 +471,12 @@
     end
 
     def add_bindir(executables)
-      if not defined? @executables || @executables.nil?
-        return nil
-      end
+      return nil if executables.nil?
 
-      if defined? @bindir and @bindir then
-        Array(@executables).map {|e| File.join(@bindir, e) }
+      if @bindir then
+        Array(executables).map { |e| File.join(@bindir, e) }
       else
-        @executables
+        executables
       end
     rescue
       return nil
@@ -511,7 +509,7 @@
         @test_files = [@test_suite_file].flatten
         @test_suite_file = nil
       end
-      if defined? @test_files and @test_files then
+      if defined?(@test_files) and @test_files then
         @test_files
       else
         @test_files = []
@@ -903,7 +901,7 @@
     # Also, the summary and description are converted to a normal
     # format. 
     def normalize
-      if defined? @extra_rdoc_files and @extra_rdoc_files then
+      if defined?(@extra_rdoc_files) and @extra_rdoc_files then
         @extra_rdoc_files.uniq!
         @files ||= []
         @files.concat(@extra_rdoc_files)
Index: lib/rubygems/exceptions.rb
===================================================================
--- lib/rubygems/exceptions.rb	(revision 15422)
+++ lib/rubygems/exceptions.rb	(revision 15423)
@@ -11,8 +11,12 @@
 
 class Gem::DependencyRemovalException < Gem::Exception; end
 
+##
+# Raised when attempting to uninstall a gem that isn't in GEM_HOME.
+class Gem::GemNotInHomeException < Gem::Exception; end
+
 class Gem::DocumentError < Gem::Exception; end
-  
+
 ##
 # Potentially raised when a specification is validated.
 class Gem::EndOfYAMLException < Gem::Exception; end
Index: lib/rubygems/source_index.rb
===================================================================
--- lib/rubygems/source_index.rb	(revision 15422)
+++ lib/rubygems/source_index.rb	(revision 15423)
@@ -46,7 +46,7 @@
         if deprecated.empty?
           from_gems_in(*installed_spec_directories)
         else
-          from_gems_in(*deprecated)
+          from_gems_in(*deprecated) # HACK warn
         end
       end
       
@@ -118,6 +118,7 @@
     def load_gems_in(*spec_dirs)
       @gems.clear
       specs = Dir.glob File.join("{#{spec_dirs.join(',')}}", "*.gemspec")
+
       specs.each do |file_name|
         gemspec = self.class.load_specification(file_name.untaint)
         add_spec(gemspec) if gemspec
Index: lib/rubygems/package.rb
===================================================================
--- lib/rubygems/package.rb	(revision 15422)
+++ lib/rubygems/package.rb	(revision 15423)
@@ -614,14 +614,16 @@
     # this method would use the String IO approach on all platforms at all
     # times.  And that's the way it is.
     def zipped_stream(entry)
-      # This is Jamis Buck's ZLib workaround.  The original code is
-      # commented out while we evaluate this patch.
-      entry.read(10) # skip the gzip header
-      zis = Zlib::Inflate.new(-Zlib::MAX_WBITS)
-      is = StringIO.new(zis.inflate(entry.read))
-      # zis = Zlib::GzipReader.new entry
-      # dis = zis.read
-      # is = StringIO.new(dis)
+      if defined? Rubinius then
+        zis = Zlib::GzipReader.new entry
+        dis = zis.read
+        is = StringIO.new(dis)
+      else
+        # This is Jamis Buck's ZLib workaround for some unknown issue
+        entry.read(10) # skip the gzip header
+        zis = Zlib::Inflate.new(-Zlib::MAX_WBITS)
+        is = StringIO.new(zis.inflate(entry.read))
+      end
     ensure
       zis.finish if zis
     end
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb	(revision 15422)
+++ lib/rubygems/installer.rb	(revision 15423)
@@ -63,6 +63,7 @@
       :force => false,
       :install_dir => Gem.dir,
       :exec_format => false,
+      :env_shebang => false
     }.merge options
 
     @env_shebang = options[:env_shebang]
Index: lib/rubygems/commands/environment_command.rb
===================================================================
--- lib/rubygems/commands/environment_command.rb	(revision 15422)
+++ lib/rubygems/commands/environment_command.rb	(revision 15423)
@@ -58,7 +58,11 @@
       end
 
       out << "  - GEM PATHS:\n"
-      Gem.path.each do |p|
+      out << "     - #{Gem.dir}\n"
+
+      path = Gem.path.dup
+      path.delete Gem.dir
+      path.each do |p|
         out << "     - #{p}\n"
       end
 
Index: lib/rubygems/commands/uninstall_command.rb
===================================================================
--- lib/rubygems/commands/uninstall_command.rb	(revision 15422)
+++ lib/rubygems/commands/uninstall_command.rb	(revision 15423)
@@ -18,18 +18,23 @@
           options[:all] = value
         end
 
-          add_option('-i', '--[no-]ignore-dependencies',
-                     'Ignore dependency requirements while',
-                     'uninstalling') do |value, options|
+        add_option('-I', '--[no-]ignore-dependencies',
+                   'Ignore dependency requirements while',
+                   'uninstalling') do |value, options|
           options[:ignore] = value
         end
 
-          add_option('-x', '--[no-]executables',
+        add_option('-x', '--[no-]executables',
                      'Uninstall applicable executables without',
                      'confirmation') do |value, options|
           options[:executables] = value
         end
 
+        add_option('-i', '--install-dir DIR',
+                   'Directory to uninstall gem from') do |value, options|
+          options[:install_dir] = File.expand_path(value)
+        end
+
         add_version_option
         add_platform_option
       end
@@ -39,7 +44,8 @@
       end
 
       def defaults_str # :nodoc:
-        "--version '#{Gem::Requirement.default}' --no-force"
+        "--version '#{Gem::Requirement.default}' --no-force " \
+        "--install-dir #{Gem.dir}"
       end
 
       def usage # :nodoc:
Index: lib/rubygems/uninstaller.rb
===================================================================
--- lib/rubygems/uninstaller.rb	(revision 15422)
+++ lib/rubygems/uninstaller.rb	(revision 15423)
@@ -25,6 +25,8 @@
   def initialize(gem, options)
     @gem = gem
     @version = options[:version] || Gem::Requirement.default
+    gem_home = options[:install_dir] || Gem.dir
+    @gem_home = File.expand_path gem_home
     @force_executables = options[:executables]
     @force_all = options[:all]
     @force_ignore = options[:ignore]
@@ -71,31 +73,38 @@
   #
   def remove_executables(gemspec)
     return if gemspec.nil?
-    if(gemspec.executables.size > 0)
-      raise Gem::FilePermissionError.new(Gem.bindir) unless
-        File.writable?(Gem.bindir)
+
+    if gemspec.executables.size > 0 then
+      bindir = Gem.bindir @gem_home
+
+      raise Gem::FilePermissionError, bindir unless File.writable? bindir
+
       list = Gem.source_index.search(gemspec.name).delete_if { |spec|
         spec.version == gemspec.version
       }
+
       executables = gemspec.executables.clone
+
       list.each do |spec|
         spec.executables.each do |exe_name|
           executables.delete(exe_name)
         end
       end
+
       return if executables.size == 0
+
       answer = @force_executables || ask_yes_no(
-        "Remove executables and scripts for\n" +
-        "'#{gemspec.executables.join(", ")}' in addition to the gem?",
+        "Remove executables:\n" \
+        "\t#{gemspec.executables.join(", ")}\n\nin addition to the gem?",
         true) # " # appease ruby-mode - don't ask
-      unless answer
+
+      unless answer then
         say "Executables and scripts will remain installed."
-        return
       else
         gemspec.executables.each do |exe_name|
           say "Removing #{exe_name}"
-          File.unlink File.join(Gem.bindir, exe_name) rescue nil
-          File.unlink File.join(Gem.bindir, exe_name + ".bat") rescue nil
+          FileUtils.rm_f File.join(bindir, exe_name)
+          FileUtils.rm_f File.join(bindir, "#{exe_name}.bat")
         end
       end
     end
@@ -119,11 +128,18 @@
   # uninstalled a gem, it is removed from that list.
   #
   def remove(spec, list)
-    unless ok_to_remove? spec then
+    unless dependencies_ok? spec then
       raise Gem::DependencyRemovalException,
             "Uninstallation aborted due to dependent gem(s)"
     end
 
+    unless path_ok? spec then
+      alert("In order to remove #{spec.name}, please execute:\n" \
+            "\tgem uninstall #{spec.name} --install-dir=#{spec.installation_path}")
+      raise Gem::GemNotInHomeException,
+            "Gem is not installed in directory #{@gem_home}"
+    end
+
     raise Gem::FilePermissionError, spec.installation_path unless
       File.writable?(spec.installation_path)
 
@@ -157,7 +173,13 @@
     list.delete spec
   end
 
-  def ok_to_remove?(spec)
+  def path_ok?(spec)
+    match_path = File.join @gem_home, 'gems', spec.full_name
+
+    match_path == spec.full_gem_path
+  end
+
+  def dependencies_ok?(spec)
     return true if @force_ignore
 
     srcindex = Gem::SourceIndex.from_installed_gems
Index: lib/rubygems.rb
===================================================================
--- lib/rubygems.rb	(revision 15422)
+++ lib/rubygems.rb	(revision 15423)
@@ -290,6 +290,24 @@
       @ruby
     end
 
+    # Return the index to insert activated gem paths into the $LOAD_PATH
+    # Defaults to the site lib directory unless gem_prelude.rb has loaded
+    # paths then it inserts the path before those paths so you can override
+    # the gem_prelude.rb default $LOAD_PATH paths.
+    def load_path_insert_index
+      index = $LOAD_PATH.index ConfigMap[:sitelibdir]
+
+      $LOAD_PATH.each_with_index do |path, i|
+        if path.instance_variables.include?(:@gem_prelude_index) or
+           path.instance_variables.include?('@gem_prelude_index') then
+          index = i
+          break
+        end
+      end
+
+      index
+    end
+
     # Activate a gem (i.e. add it to the Ruby load path).  The gem
     # must satisfy all the specified version constraints.  If
     # +autorequire+ is true, then automatically require the specified
@@ -345,11 +363,13 @@
       end
 
       sitelibdir = ConfigMap[:sitelibdir]
-      sitelibdir_index = $LOAD_PATH.index sitelibdir
 
-      if sitelibdir_index then
+      # gem directories must come after -I and ENV['RUBYLIB']
+      insert_index = load_path_insert_index
+
+      if insert_index then
         # gem directories must come after -I and ENV['RUBYLIB']
-        $LOAD_PATH.insert(sitelibdir_index, *require_paths)
+        $LOAD_PATH.insert(insert_index, *require_paths)
       else
         # we are probably testing in core, -I and RUBYLIB don't apply
         $LOAD_PATH.unshift(*require_paths)
Index: bin/gem
===================================================================
--- bin/gem	(revision 15422)
+++ bin/gem	(revision 15423)
@@ -8,7 +8,7 @@
 require 'rubygems'
 require 'rubygems/gem_runner'
 
-required_version = Gem::Requirement.new ">= 1.8.2"
+required_version = Gem::Requirement.new ">= 1.8.3"
 
 unless required_version.satisfied_by? Gem::Version.new(RUBY_VERSION) then
   abort "Expected Ruby Version #{required_version}, was #{RUBY_VERSION}"
Index: test/rubygems/test_kernel.rb
===================================================================
--- test/rubygems/test_kernel.rb	(revision 15422)
+++ test/rubygems/test_kernel.rb	(revision 15423)
@@ -7,6 +7,7 @@
 
 require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
+require 'rubygems/package'
 
 class TestKernel < RubyGemTestCase
 
Index: test/rubygems/test_gem_dependency_installer.rb
===================================================================
--- test/rubygems/test_gem_dependency_installer.rb	(revision 15422)
+++ test/rubygems/test_gem_dependency_installer.rb	(revision 15423)
@@ -288,19 +288,21 @@
     assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
   end
 
-  def test_install_security_policy
-    FileUtils.mv @a1_gem, @cache_dir
-    FileUtils.mv @b1_gem, @cache_dir
-    policy = Gem::Security::HighSecurity
-    inst = Gem::DependencyInstaller.new 'b', nil, :security_policy => policy
+  if defined? OpenSSL then
+    def test_install_security_policy
+      FileUtils.mv @a1_gem, @cache_dir
+      FileUtils.mv @b1_gem, @cache_dir
+      policy = Gem::Security::HighSecurity
+      inst = Gem::DependencyInstaller.new 'b', nil, :security_policy => policy
 
-    e = assert_raise Gem::Exception do
-      inst.install
-    end
+      e = assert_raise Gem::Exception do
+        inst.install
+      end
 
-    assert_equal 'Unsigned gem', e.message
+      assert_equal 'Unsigned gem', e.message
 
-    assert_equal %w[], inst.installed_gems.map { |s| s.full_name }
+      assert_equal %w[], inst.installed_gems.map { |s| s.full_name }
+    end
   end
 
   def test_install_wrappers
Index: test/rubygems/test_gem_commands_specification_command.rb
===================================================================
--- test/rubygems/test_gem_commands_specification_command.rb	(revision 15422)
+++ test/rubygems/test_gem_commands_specification_command.rb	(revision 15423)
@@ -85,7 +85,8 @@
       @cmd.execute
     end
 
-    assert_equal "#{foo.to_yaml}\n", @ui.output
+    assert_match %r|\A--- !ruby/object:Gem::Specification|, @ui.output
+    assert_match %r|name: foo|, @ui.output
     assert_equal "WARNING:  Remote information is not complete\n\n", @ui.error
   end
 
Index: test/rubygems/test_gem_commands_environment_command.rb
===================================================================
--- test/rubygems/test_gem_commands_environment_command.rb	(revision 15422)
+++ test/rubygems/test_gem_commands_environment_command.rb	(revision 15423)
@@ -25,7 +25,8 @@
     assert_match %r|INSTALLATION DIRECTORY: #{Regexp.escape @gemhome}|,
                  @ui.output
     assert_match %r|RUBYGEMS PREFIX: |, @ui.output
-    assert_match %r|RUBY EXECUTABLE:.*ruby|, @ui.output
+    assert_match %r|RUBY EXECUTABLE:.*#{Gem::ConfigMap[:RUBY_INSTALL_NAME]}|,
+                 @ui.output
     assert_match %r|RUBYGEMS PLATFORMS:|, @ui.output
     assert_match %r|- #{Gem::Platform.local}|, @ui.output
     assert_match %r|GEM PATHS:|, @ui.output
Index: test/rubygems/test_gem_source_index.rb
===================================================================
--- test/rubygems/test_gem_source_index.rb	(revision 15422)
+++ test/rubygems/test_gem_source_index.rb	(revision 15423)
@@ -401,7 +401,7 @@
   def test_update_with_missing
     marshal_uri = File.join @gem_repo, "quick", "Marshal.#{@marshal_version}",
                             "#{@gem3.full_name}.gemspec.rz"
-    dumped = Marshal.dump(@gem3)
+    dumped = Marshal.dump @gem3
     @fetcher.data[marshal_uri] = util_zip(dumped)
 
     use_ui @ui do
Index: test/rubygems/test_gem_remote_fetcher.rb
===================================================================
--- test/rubygems/test_gem_remote_fetcher.rb	(revision 15422)
+++ test/rubygems/test_gem_remote_fetcher.rb	(revision 15423)
@@ -271,7 +271,7 @@
       fetcher.fetch_path 'uri'
     end
 
-    assert_match %r|\AErrno::ECONNREFUSED: .* - connect\(2\) reading uri\z|,
+    assert_match %r|ECONNREFUSED:.*connect\(2\) reading uri\z|,
                  e.message
   end
 
Index: test/rubygems/test_gem_server.rb
===================================================================
--- test/rubygems/test_gem_server.rb	(revision 15422)
+++ test/rubygems/test_gem_server.rb	(revision 15423)
@@ -53,10 +53,10 @@
     assert_equal 200, @res.status, @res.body
     assert @res['date']
     assert_equal 'text/plain', @res['content-type']
-    yaml = Zlib::Inflate.inflate(@res.body)
-    assert_match %r|Gem::Specification|, yaml
-    assert_match %r|name: a|, yaml
-    assert_match %r|version: "1"|, yaml
+
+    spec = YAML.load Zlib::Inflate.inflate(@res.body)
+    assert_equal 'a', spec.name
+    assert_equal Gem::Version.new(1), spec.version
   end
 
   def test_quick_a_1_mswin32_gemspec_rz
@@ -72,10 +72,11 @@
     assert_equal 200, @res.status, @res.body
     assert @res['date']
     assert_equal 'text/plain', @res['content-type']
-    yaml = Zlib::Inflate.inflate(@res.body)
-    assert_match %r|Gem::Specification|, yaml
-    assert_match %r|name: a|, yaml
-    assert_match %r|version: "1"|, yaml
+
+    spec = YAML.load Zlib::Inflate.inflate(@res.body)
+    assert_equal 'a', spec.name
+    assert_equal Gem::Version.new(1), spec.version
+    assert_equal Gem::Platform.local, spec.platform
   end
 
   def test_quick_common_substrings
@@ -91,10 +92,10 @@
     assert_equal 200, @res.status, @res.body
     assert @res['date']
     assert_equal 'text/plain', @res['content-type']
-    yaml = Zlib::Inflate.inflate @res.body
-    assert_match %r|Gem::Specification|, yaml
-    assert_match %r|name: a$|, yaml
-    assert_match %r|version: "1"|, yaml
+
+    spec = YAML.load Zlib::Inflate.inflate(@res.body)
+    assert_equal 'a', spec.name
+    assert_equal Gem::Version.new(1), spec.version
   end
 
   def test_quick_z_9_gemspec_rz
Index: test/rubygems/test_gem_commands_fetch_command.rb
===================================================================
--- test/rubygems/test_gem_commands_fetch_command.rb	(revision 15422)
+++ test/rubygems/test_gem_commands_fetch_command.rb	(revision 15423)
@@ -1,5 +1,7 @@
 require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
+require 'rubygems/package'
+require 'rubygems/security'
 require 'rubygems/commands/fetch_command'
 
 class TestGemCommandsFetchCommand < RubyGemTestCase
Index: test/rubygems/test_gem_commands_cert_command.rb
===================================================================
--- test/rubygems/test_gem_commands_cert_command.rb	(revision 15422)
+++ test/rubygems/test_gem_commands_cert_command.rb	(revision 15423)
@@ -3,6 +3,10 @@
 
 require 'rubygems/commands/cert_command'
 
+unless defined? OpenSSL then
+  warn "`gem cert` tests are being skipped, module OpenSSL not found"
+end
+
 class TestGemCommandsCertCommand < RubyGemTestCase
 
   def setup
@@ -118,5 +122,5 @@
     # HACK this test sucks
   end
 
-end
+end if defined? OpenSSL
 
Index: test/rubygems/test_gem.rb
===================================================================
--- test/rubygems/test_gem.rb	(revision 15422)
+++ test/rubygems/test_gem.rb	(revision 15423)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems'
 require 'rubygems/gem_openssl'
@@ -75,6 +74,8 @@
       install_gem foo
     end
 
+    Gem.source_index = nil
+
     gem 'foo'
 
     expected = File.join @gemhome, 'gems', foo.full_name, 'data', 'foo'
@@ -280,9 +281,7 @@
 
   def test_self_prefix
     file_name = File.expand_path __FILE__
-    expected = File.dirname File.dirname(file_name)
-    expected = File.dirname expected if expected =~ %r|/test| # for Ruby trunk
-    assert_equal expected, Gem.prefix
+    assert_equal File.dirname(File.dirname(file_name)), Gem.prefix
   end
 
   def test_self_required_location
Index: test/rubygems/test_gem_version.rb
===================================================================
--- test/rubygems/test_gem_version.rb	(revision 15422)
+++ test/rubygems/test_gem_version.rb	(revision 15423)
@@ -185,7 +185,7 @@
 
   def assert_adequate(version, requirement)
     ver = Gem::Version.new(version)
-    req = Gem::Version::Requirement.new(requirement)
+    req = Gem::Requirement.new(requirement)
     assert req.satisfied_by?(ver),
       "Version #{version} should be adequate for Requirement #{requirement}"
   end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]