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

ruby-changes:8410

From: drbrain <ko1@a...>
Date: Sun, 26 Oct 2008 08:01:15 +0900 (JST)
Subject: [ruby-changes:8410] Ruby:r19941 (trunk): Update to RubyGems 1.3.1 r1909.

drbrain	2008-10-26 07:58:43 +0900 (Sun, 26 Oct 2008)

  New Revision: 19941

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19941

  Log:
    Update to RubyGems 1.3.1 r1909.

  Modified files:
    trunk/ChangeLog
    trunk/gem_prelude.rb
    trunk/lib/rubygems/commands/check_command.rb
    trunk/lib/rubygems/commands/unpack_command.rb
    trunk/lib/rubygems/commands/update_command.rb
    trunk/lib/rubygems/config_file.rb
    trunk/lib/rubygems/custom_require.rb
    trunk/lib/rubygems/defaults.rb
    trunk/lib/rubygems/installer.rb
    trunk/lib/rubygems/rubygems_version.rb
    trunk/lib/rubygems/source_index.rb
    trunk/lib/rubygems/validator.rb
    trunk/lib/rubygems.rb
    trunk/test/rubygems/functional.rb
    trunk/test/rubygems/gem_installer_test_case.rb
    trunk/test/rubygems/gemutilities.rb
    trunk/test/rubygems/test_config.rb
    trunk/test/rubygems/test_gem.rb
    trunk/test/rubygems/test_gem_builder.rb
    trunk/test/rubygems/test_gem_command.rb
    trunk/test/rubygems/test_gem_command_manager.rb
    trunk/test/rubygems/test_gem_commands_build_command.rb
    trunk/test/rubygems/test_gem_commands_cert_command.rb
    trunk/test/rubygems/test_gem_commands_check_command.rb
    trunk/test/rubygems/test_gem_commands_contents_command.rb
    trunk/test/rubygems/test_gem_commands_dependency_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_generate_index_command.rb
    trunk/test/rubygems/test_gem_commands_install_command.rb
    trunk/test/rubygems/test_gem_commands_list_command.rb
    trunk/test/rubygems/test_gem_commands_lock_command.rb
    trunk/test/rubygems/test_gem_commands_mirror_command.rb
    trunk/test/rubygems/test_gem_commands_outdated_command.rb
    trunk/test/rubygems/test_gem_commands_pristine_command.rb
    trunk/test/rubygems/test_gem_commands_query_command.rb
    trunk/test/rubygems/test_gem_commands_server_command.rb
    trunk/test/rubygems/test_gem_commands_sources_command.rb
    trunk/test/rubygems/test_gem_commands_specification_command.rb
    trunk/test/rubygems/test_gem_commands_stale_command.rb
    trunk/test/rubygems/test_gem_commands_uninstall_command.rb
    trunk/test/rubygems/test_gem_commands_unpack_command.rb
    trunk/test/rubygems/test_gem_commands_update_command.rb
    trunk/test/rubygems/test_gem_config_file.rb
    trunk/test/rubygems/test_gem_dependency.rb
    trunk/test/rubygems/test_gem_dependency_installer.rb
    trunk/test/rubygems/test_gem_dependency_list.rb
    trunk/test/rubygems/test_gem_digest.rb
    trunk/test/rubygems/test_gem_doc_manager.rb
    trunk/test/rubygems/test_gem_ext_configure_builder.rb
    trunk/test/rubygems/test_gem_ext_ext_conf_builder.rb
    trunk/test/rubygems/test_gem_ext_rake_builder.rb
    trunk/test/rubygems/test_gem_format.rb
    trunk/test/rubygems/test_gem_gem_path_searcher.rb
    trunk/test/rubygems/test_gem_gem_runner.rb
    trunk/test/rubygems/test_gem_indexer.rb
    trunk/test/rubygems/test_gem_install_update_options.rb
    trunk/test/rubygems/test_gem_installer.rb
    trunk/test/rubygems/test_gem_local_remote_options.rb
    trunk/test/rubygems/test_gem_package_tar_reader_entry.rb
    trunk/test/rubygems/test_gem_package_tar_writer.rb
    trunk/test/rubygems/test_gem_platform.rb
    trunk/test/rubygems/test_gem_remote_fetcher.rb
    trunk/test/rubygems/test_gem_requirement.rb
    trunk/test/rubygems/test_gem_server.rb
    trunk/test/rubygems/test_gem_source_index.rb
    trunk/test/rubygems/test_gem_source_info_cache.rb
    trunk/test/rubygems/test_gem_source_info_cache_entry.rb
    trunk/test/rubygems/test_gem_spec_fetcher.rb
    trunk/test/rubygems/test_gem_specification.rb
    trunk/test/rubygems/test_gem_stream_ui.rb
    trunk/test/rubygems/test_gem_validator.rb
    trunk/test/rubygems/test_gem_version.rb
    trunk/test/rubygems/test_gem_version_option.rb
    trunk/test/rubygems/test_kernel.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19940)
+++ ChangeLog	(revision 19941)
@@ -1,5 +1,9 @@
-Sun Oct 26 07:35:56 2008  Ryan Davis  <ryan@w...>
+Sun Oct 26 07:57:35 2008  Eric Hodel  <drbrain@s...>
 
+	* lib/rubygems*:  Update to RubyGems 1.3.1 r1909.
+
+Sun Oct 26 07:35:56 2008  Ryan Davis  <ryand-ruby@z...>
+
 	* lib/minitest/unit.rb: Imported minitest 1.3.0 r4429.
 	* test/minitest/*: ditto.
 
Index: gem_prelude.rb
===================================================================
--- gem_prelude.rb	(revision 19940)
+++ gem_prelude.rb	(revision 19941)
@@ -24,14 +24,6 @@
       :ruby_install_name => RbConfig::CONFIG["ruby_install_name"]
     }
 
-    def self.default_dir
-      if defined? RUBY_FRAMEWORK_VERSION
-        return File.join(File.dirname(ConfigMap[:sitedir]), "Gems")
-      else
-        File.join(ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version])
-      end
-    end
-
     def self.dir
       @gem_home ||= nil
       set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
@@ -48,7 +40,22 @@
       @gem_path
     end
 
-    # Set the Gem home directory (as reported by +dir+).
+    def self.post_install(&hook)
+      @post_install_hooks << hook
+    end
+
+    def self.post_uninstall(&hook)
+      @post_uninstall_hooks << hook
+    end
+
+    def self.pre_install(&hook)
+      @pre_install_hooks << hook
+    end
+
+    def self.pre_uninstall(&hook)
+      @pre_uninstall_hooks << hook
+    end
+
     def self.set_home(home)
       @gem_home = home
       ensure_gem_subdirectories(@gem_home)
@@ -68,8 +75,25 @@
     def self.ensure_gem_subdirectories(path)
     end
 
+    # Methods before this line will be removed when QuickLoader is replaced
+    # with the real RubyGems
+
     GEM_PRELUDE_METHODS = Gem.methods(false)
 
+    require 'rubygems/defaults'
+
+    begin
+      require 'rubygems/defaults/operating_system'
+    rescue LoadError
+    end
+
+    if defined?(RUBY_ENGINE) then
+      begin
+        require 'rubygems/defaults/#{RUBY_ENGINE}'
+      rescue LoadError
+      end
+    end
+
     module QuickLoader
 
       def self.load_full_rubygems_library
Index: lib/rubygems/validator.rb
===================================================================
--- lib/rubygems/validator.rb	(revision 19940)
+++ lib/rubygems/validator.rb	(revision 19941)
@@ -10,118 +10,130 @@
 require 'rubygems/format'
 require 'rubygems/installer'
 
-module Gem
+##
+# Validator performs various gem file and gem database validation
 
-  ##
-  # Validator performs various gem file and gem database validation
-  class Validator
-    include UserInteraction
+class Gem::Validator
 
-    ##
-    # Given a gem file's contents, validates against its own MD5 checksum
-    # gem_data:: [String] Contents of the gem file
-    def verify_gem(gem_data)
-      raise VerificationError, 'empty gem file' if gem_data.size == 0
+  include Gem::UserInteraction
 
-      unless gem_data =~ /MD5SUM/ then
-        return # Don't worry about it...this sucks.  Need to fix MD5 stuff for
-               # new format
-               # FIXME
-      end
+  ##
+  # Given a gem file's contents, validates against its own MD5 checksum
+  # gem_data:: [String] Contents of the gem file
 
-      sum_data = gem_data.gsub(/MD5SUM = "([a-z0-9]+)"/,
-                               "MD5SUM = \"#{"F" * 32}\"")
+  def verify_gem(gem_data)
+    raise Gem::VerificationError, 'empty gem file' if gem_data.size == 0
 
-      unless Gem::MD5.hexdigest(sum_data) == $1.to_s then
-        raise VerificationError, 'invalid checksum for gem file'
-      end
+    unless gem_data =~ /MD5SUM/ then
+      return # Don't worry about it...this sucks.  Need to fix MD5 stuff for
+      # new format
+      # FIXME
     end
 
-    ##
-    # Given the path to a gem file, validates against its own MD5 checksum
-    # 
-    # gem_path:: [String] Path to gem file
-    def verify_gem_file(gem_path)
-      open gem_path, Gem.binary_mode do |file|
-        gem_data = file.read
-        verify_gem gem_data
-      end
-    rescue Errno::ENOENT
-      raise Gem::VerificationError.new("missing gem file #{gem_path}")
+    sum_data = gem_data.gsub(/MD5SUM = "([a-z0-9]+)"/,
+                             "MD5SUM = \"#{"F" * 32}\"")
+
+    unless Gem::MD5.hexdigest(sum_data) == $1.to_s then
+      raise Gem::VerificationError, 'invalid checksum for gem file'
     end
+  end
 
-    private
-    def find_files_for_gem(gem_directory)
-      installed_files = []
-      Find.find(gem_directory) {|file_name|
-        fn = file_name.slice((gem_directory.size)..(file_name.size-1)).sub(/^\//, "")
-        if(!(fn =~ /CVS/ || File.directory?(fn) || fn == "")) then 
-          installed_files << fn
-        end
-        
-      }
-      installed_files
+  ##
+  # Given the path to a gem file, validates against its own MD5 checksum
+  #
+  # gem_path:: [String] Path to gem file
+
+  def verify_gem_file(gem_path)
+    open gem_path, Gem.binary_mode do |file|
+      gem_data = file.read
+      verify_gem gem_data
     end
- 
+  rescue Errno::ENOENT
+    raise Gem::VerificationError, "missing gem file #{gem_path}"
+  end
 
-    public 
-    ErrorData = Struct.new(:path, :problem)
+  private
 
-    ##
-    # Checks the gem directory for the following potential 
-    # inconsistencies/problems:
-    # * Checksum gem itself
-    # * For each file in each gem, check consistency of installed versions
-    # * Check for files that aren't part of the gem but are in the gems directory
-    # * 1 cache - 1 spec - 1 directory.  
-    # 
-    # returns a hash of ErrorData objects, keyed on the problem gem's name.
-    def alien
-      errors = {}
-      Gem::SourceIndex.from_installed_gems.each do |gem_name, gem_spec|
-        errors[gem_name] ||= []
-        gem_path = File.join(Gem.dir, "cache", gem_spec.full_name) + ".gem"
-        spec_path = File.join(Gem.dir, "specifications", gem_spec.full_name) + ".gemspec"
-        gem_directory = File.join(Gem.dir, "gems", gem_spec.full_name)
-        installed_files = find_files_for_gem(gem_directory)
-    
-        if(!File.exist?(spec_path)) then
-          errors[gem_name] << ErrorData.new(spec_path, "Spec file doesn't exist for installed gem")
-        end
-    
-        begin
-          verify_gem_file(gem_path)
-          open gem_path, Gem.binary_mode do |file|
-            format = Gem::Format.from_file_by_path(gem_path)
-            format.file_entries.each do |entry, data|
-              # Found this file.  Delete it from list
-              installed_files.delete remove_leading_dot_dir(entry['path'])
+  def find_files_for_gem(gem_directory)
+    installed_files = []
+    Find.find(gem_directory) {|file_name|
+      fn = file_name.slice((gem_directory.size)..(file_name.size-1)).sub(/^\//, "")
+      if(!(fn =~ /CVS/ || File.directory?(fn) || fn == "")) then
+        installed_files << fn
+      end
 
-              next unless data # HACK `gem check -a mkrf`
+    }
+    installed_files
+  end
 
-              open File.join(gem_directory, entry['path']), Gem.binary_mode do |f|
-                unless Gem::MD5.hexdigest(f.read).to_s ==
-                       Gem::MD5.hexdigest(data).to_s then
-                  errors[gem_name] << ErrorData.new(entry['path'], "installed file doesn't match original from gem")
-                end
+  public
+
+  ErrorData = Struct.new :path, :problem
+
+  ##
+  # Checks the gem directory for the following potential
+  # inconsistencies/problems:
+  #
+  # * Checksum gem itself
+  # * For each file in each gem, check consistency of installed versions
+  # * Check for files that aren't part of the gem but are in the gems directory
+  # * 1 cache - 1 spec - 1 directory.
+  #
+  # returns a hash of ErrorData objects, keyed on the problem gem's name.
+
+  def alien
+    errors = {}
+
+    Gem::SourceIndex.from_installed_gems.each do |gem_name, gem_spec|
+      errors[gem_name] ||= []
+
+      gem_path = File.join(Gem.dir, "cache", gem_spec.full_name) + ".gem"
+      spec_path = File.join(Gem.dir, "specifications", gem_spec.full_name) + ".gemspec"
+      gem_directory = File.join(Gem.dir, "gems", gem_spec.full_name)
+
+      installed_files = find_files_for_gem(gem_directory)
+
+      unless File.exist? spec_path then
+        errors[gem_name] << ErrorData.new(spec_path, "Spec file doesn't exist for installed gem")
+      end
+
+      begin
+        verify_gem_file(gem_path)
+
+        open gem_path, Gem.binary_mode do |file|
+          format = Gem::Format.from_file_by_path(gem_path)
+          format.file_entries.each do |entry, data|
+            # Found this file.  Delete it from list
+            installed_files.delete remove_leading_dot_dir(entry['path'])
+
+            next unless data # HACK `gem check -a mkrf`
+
+            open File.join(gem_directory, entry['path']), Gem.binary_mode do |f|
+              unless Gem::MD5.hexdigest(f.read).to_s ==
+                Gem::MD5.hexdigest(data).to_s then
+                errors[gem_name] << ErrorData.new(entry['path'], "installed file doesn't match original from gem")
               end
             end
           end
-        rescue VerificationError => e
-          errors[gem_name] << ErrorData.new(gem_path, e.message)
         end
-        # Clean out directories that weren't explicitly included in the gemspec
-        # FIXME: This still allows arbitrary incorrect directories.
-        installed_files.delete_if {|potential_directory|        
-          File.directory?(File.join(gem_directory, potential_directory))
-        }
-        if(installed_files.size > 0) then
-          errors[gem_name] << ErrorData.new(gem_path, "Unmanaged files in gem: #{installed_files.inspect}")
-        end
+      rescue Gem::VerificationError => e
+        errors[gem_name] << ErrorData.new(gem_path, e.message)
       end
-      errors
+
+      # Clean out directories that weren't explicitly included in the gemspec
+      # FIXME: This still allows arbitrary incorrect directories.
+      installed_files.delete_if {|potential_directory|
+        File.directory?(File.join(gem_directory, potential_directory))
+      }
+      if(installed_files.size > 0) then
+        errors[gem_name] << ErrorData.new(gem_path, "Unmanaged files in gem: #{installed_files.inspect}")
+      end
     end
 
+    errors
+  end
+
+  if RUBY_VERSION < '1.9' then
     class TestRunner
       def initialize(suite, ui)
         @suite = suite
@@ -147,40 +159,50 @@
     end
 
     autoload :TestRunner, 'test/unit/ui/testrunnerutilities'
-   
-    ##
-    # Runs unit tests for a given gem specification
-    def unit_test(gem_spec)
-     start_dir = Dir.pwd
-     Dir.chdir(gem_spec.full_gem_path)
-      $: << File.join(Gem.dir, "gems", gem_spec.full_name)
-        # XXX: why do we need this gem_spec when we've already got 'spec'?
-      test_files = gem_spec.test_files
-      if test_files.empty?
-        say "There are no unit tests to run for #{gem_spec.full_name}"
-        require 'test/unit/ui/console/testrunner'
-        return Test::Unit::TestResult.new
-      end
-      gem gem_spec.name, "= #{gem_spec.version.version}"
-      test_files.each do |f| require f end
+  end
+
+  ##
+  # Runs unit tests for a given gem specification
+
+  def unit_test(gem_spec)
+    start_dir = Dir.pwd
+    Dir.chdir(gem_spec.full_gem_path)
+    $: << File.join(Gem.dir, "gems", gem_spec.full_name)
+    # XXX: why do we need this gem_spec when we've already got 'spec'?
+    test_files = gem_spec.test_files
+
+    if test_files.empty? then
+      say "There are no unit tests to run for #{gem_spec.full_name}"
+      return nil
+    end
+
+    gem gem_spec.name, "= #{gem_spec.version.version}"
+
+    test_files.each do |f| require f end
+
+    if RUBY_VERSION < '1.9' then
       suite = Test::Unit::TestSuite.new("#{gem_spec.name}-#{gem_spec.version}")
+
       ObjectSpace.each_object(Class) do |klass|
         suite << klass.suite if (klass < Test::Unit::TestCase)
       end
-      result = TestRunner.run(suite, ui())
-      unless result.passed?
-        alert_error(result.to_s)
-        #unless ask_yes_no(result.to_s + "...keep Gem?", true) then
-          #Gem::Uninstaller.new(gem_spec.name, gem_spec.version.version).uninstall
-        #end
-      end
-      result
-    ensure
-      Dir.chdir(start_dir)
+
+      result = TestRunner.run suite, ui
+
+      alert_error result.to_s unless result.passed?
+    else
+      result = MiniTest::Unit.new
+      result.run
     end
 
-    def remove_leading_dot_dir(path)
-      path.sub(/^\.\//, "")
-    end
+    result
+  ensure
+    Dir.chdir(start_dir)
   end
+
+  def remove_leading_dot_dir(path)
+    path.sub(/^\.\//, "")
+  end
+
 end
+
Index: lib/rubygems/config_file.rb
===================================================================
--- lib/rubygems/config_file.rb	(revision 19940)
+++ lib/rubygems/config_file.rb	(revision 19941)
@@ -52,6 +52,8 @@
   # Where to look for gems
   attr_accessor :path
 
+  attr_accessor :home
+
   # True if we print backtraces on errors.
   attr_writer :backtrace
 
@@ -129,7 +131,8 @@
     Gem.sources = @hash[:sources] if @hash.key? :sources
     @verbose = @hash[:verbose] if @hash.key? :verbose
     @update_sources = @hash[:update_sources] if @hash.key? :update_sources
-    @path = @hash[:gempath]
+    @path = @hash[:gempath] if @hash.key? :gempath
+    @home = @hash[:gemhome] if @hash.key? :gemhome
 
     handle_arguments arg_list
   end
Index: lib/rubygems/custom_require.rb
===================================================================
--- lib/rubygems/custom_require.rb	(revision 19940)
+++ lib/rubygems/custom_require.rb	(revision 19941)
@@ -7,12 +7,16 @@
 require 'rubygems'
 
 module Kernel
-  alias gem_original_require require # :nodoc:
 
+  ##
+  # The Kernel#require from before RubyGems was loaded.
+
+  alias gem_original_require require
+
+  ##
+  # When RubyGems is required, Kernel#require is replaced with our own which
+  # is capable of loading gems on demand.
   #
-  # We replace Ruby's require with our own, which is capable of
-  # loading gems on demand.
-  #
   # When you call <tt>require 'x'</tt>, this is what happens:
   # * If the file can be loaded from the existing Ruby loadpath, it
   #   is.
@@ -22,8 +26,8 @@
   #
   # The normal <tt>require</tt> functionality of returning false if
   # that file has already been loaded is preserved.
-  #
-  def require(path) # :nodoc:
+
+  def require(path) # :doc:
     gem_original_require path
   rescue LoadError => load_error
     if load_error.message =~ /#{Regexp.escape path}\z/ and
@@ -34,5 +38,9 @@
       raise load_error
     end
   end
-end  # module Kernel
 
+  private :require
+  private :gem_original_require
+
+end
+
Index: lib/rubygems/source_index.rb
===================================================================
--- lib/rubygems/source_index.rb	(revision 19940)
+++ lib/rubygems/source_index.rb	(revision 19941)
@@ -257,8 +257,7 @@
 
     # TODO - Remove support and warning for legacy arguments after 2008/11
     unless Gem::Dependency === gem_pattern
-      warn "Gem::SourceIndex#search support for #{gem_pattern.class} patterns is deprecated"
-      warn "#{caller[0]} is outdated" 
+      warn "#{Gem.location_of_caller.join ':'}:Warning: Gem::SourceIndex#search support for #{gem_pattern.class} patterns is deprecated"
     end
 
     case gem_pattern
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb	(revision 19940)
+++ lib/rubygems/installer.rb	(revision 19941)
@@ -137,7 +137,7 @@
       options[:user_install] = true
     end
 
-    if options[:user_install] then
+    if options[:user_install] and not options[:unpack] then
       @gem_home = Gem.user_dir
 
       user_bin_dir = File.join(@gem_home, 'bin')
Index: lib/rubygems/commands/unpack_command.rb
===================================================================
--- lib/rubygems/commands/unpack_command.rb	(revision 19940)
+++ lib/rubygems/commands/unpack_command.rb	(revision 19941)
@@ -43,7 +43,7 @@
       basename = File.basename(path).sub(/\.gem$/, '')
       target_dir = File.expand_path File.join(options[:target], basename)
       FileUtils.mkdir_p target_dir
-      Gem::Installer.new(path).unpack target_dir
+      Gem::Installer.new(path, :unpack => true).unpack target_dir
       say "Unpacked gem: '#{target_dir}'"
     else
       alert_error "Gem '#{gemname}' not installed."
Index: lib/rubygems/commands/update_command.rb
===================================================================
--- lib/rubygems/commands/update_command.rb	(revision 19940)
+++ lib/rubygems/commands/update_command.rb	(revision 19941)
@@ -54,11 +54,10 @@
         fail "No gem names are allowed with the --system option"
       end
 
-      spec = Gem::Specification.new
-      spec.name = 'rubygems-update'
-      spec.version = Gem::Version.new Gem::RubyGemsVersion
-      spec.version = Gem::Version.new '1.1.1'
-      hig['rubygems-update'] = spec
+      rubygems_update = Gem::Specification.new
+      rubygems_update.name = 'rubygems-update'
+      rubygems_update.version = Gem::Version.new Gem::RubyGemsVersion
+      hig['rubygems-update'] = rubygems_update
 
       options[:user_install] = false
     else
Index: lib/rubygems/commands/check_command.rb
===================================================================
--- lib/rubygems/commands/check_command.rb	(revision 19940)
+++ lib/rubygems/commands/check_command.rb	(revision 19941)
@@ -31,7 +31,8 @@
   def execute
     if options[:test]
       version = options[:version] || Gem::Requirement.default
-      gem_spec = Gem::SourceIndex.from_installed_gems.search(get_one_gem_name, version).first
+      dep = Gem::Dependency.new get_one_gem_name, version
+      gem_spec = Gem::SourceIndex.from_installed_gems.search(dep).first
       Gem::Validator.new.unit_test(gem_spec)
     end
 
Index: lib/rubygems/rubygems_version.rb
===================================================================
--- lib/rubygems/rubygems_version.rb	(revision 19940)
+++ lib/rubygems/rubygems_version.rb	(revision 19941)
@@ -2,5 +2,5 @@
 # This file is auto-generated by build scripts.
 # See:  rake update_version
 module Gem
-  RubyGemsVersion = '1.3.0'
+  RubyGemsVersion = '1.3.1'
 end
Index: lib/rubygems/defaults.rb
===================================================================
--- lib/rubygems/defaults.rb	(revision 19940)
+++ lib/rubygems/defaults.rb	(revision 19941)
@@ -1,5 +1,10 @@
 module Gem
 
+  @post_install_hooks   ||= []
+  @post_uninstall_hooks ||= []
+  @pre_uninstall_hooks  ||= []
+  @pre_install_hooks    ||= []
+
   ##
   # An Array of the default sources that come with RubyGems
 
Index: lib/rubygems.rb
===================================================================
--- lib/rubygems.rb	(revision 19940)
+++ lib/rubygems.rb	(revision 19941)
@@ -43,12 +43,14 @@
   #
   #   GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb
 
-  def gem(gem_name, *version_requirements)
+  def gem(gem_name, *version_requirements) # :doc:
     skip_list = (ENV['GEM_SKIP'] || "").split(/:/)
     raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
     Gem.activate(gem_name, *version_requirements)
   end
 
+  private :gem
+
 end
 
 ##
@@ -104,10 +106,10 @@
   @ruby = nil
   @sources = []
 
-  @post_install_hooks = []
-  @post_uninstall_hooks = []
-  @pre_uninstall_hooks = []
-  @pre_install_hooks = []
+  @post_install_hooks   ||= []
+  @post_uninstall_hooks ||= []
+  @pre_uninstall_hooks  ||= []
+  @pre_install_hooks    ||= []
 
   ##
   # Activates an installed gem matching +gem+.  The gem must satisfy
@@ -294,6 +296,7 @@
   # A Zlib::Deflate.deflate wrapper
 
   def self.deflate(data)
+    require 'zlib'
     Zlib::Deflate.deflate data
   end
 
@@ -302,7 +305,7 @@
 
   def self.dir
     @gem_home ||= nil
-    set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
+    set_home(ENV['GEM_HOME'] || Gem.configuration.home || default_dir) unless @gem_home
     @gem_home
   end
 
@@ -395,6 +398,8 @@
   # Zlib::GzipReader wrapper that unzips +data+.
 
   def self.gunzip(data)
+    require 'stringio'
+    require 'zlib'
     data = StringIO.new data
 
     Zlib::GzipReader.new(data).read
@@ -404,6 +409,8 @@
   # Zlib::GzipWriter wrapper that zips +data+.
 
   def self.gzip(data)
+    require 'stringio'
+    require 'zlib'
     zipped = StringIO.new
 
     Zlib::GzipWriter.wrap zipped do |io| io.write data end
@@ -415,6 +422,7 @@
   # A Zlib::Inflate#inflate wrapper
 
   def self.inflate(data)
+    require 'zlib'
     Zlib::Inflate.inflate data
   end
 
@@ -479,13 +487,13 @@
   # The file name and line number of the caller of the caller of this method.
 
   def self.location_of_caller
-    file, lineno = caller[1].split(':')
-    lineno = lineno.to_i
+    caller[1] =~ /(.*?):(\d+)$/i
+    file = $1
+    lineno = $2.to_i
+
     [file, lineno]
   end
 
-  private_class_method :location_of_caller
-
   ##
   # manage_gems is useless and deprecated.  Don't call it anymore.
 
@@ -709,9 +717,11 @@
 
     @gem_path.uniq!
     @gem_path.each do |path|
-      if 0 == File.expand_path(path).index(Gem.user_home) and
-         Etc.getpwuid.uid != File::Stat.new(Gem.user_home).uid then
-        next # only create by matching user
+      if 0 == File.expand_path(path).index(Gem.user_home)
+        unless win_platform? then
+          # only create by matching user
+          next if Etc.getpwuid.uid != File::Stat.new(Gem.user_home).uid
+        end
       end
       ensure_gem_subdirectories path
     end
Index: test/rubygems/test_gem_commands_uninstall_command.rb
===================================================================
--- test/rubygems/test_gem_commands_uninstall_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_uninstall_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require File.join(File.expand_path(File.dirname(__FILE__)),
                   'gem_installer_test_case')
@@ -48,7 +47,7 @@
 
   def test_execute_not_installed
     @cmd.options[:args] = ["foo"]
-    e = assert_raise(Gem::InstallError) do
+    e = assert_raises Gem::InstallError do
       use_ui @ui do
         @cmd.execute
       end
Index: test/rubygems/test_kernel.rb
===================================================================
--- test/rubygems/test_kernel.rb	(revision 19940)
+++ test/rubygems/test_kernel.rb	(revision 19941)
@@ -1,11 +1,9 @@
-#!/usr/bin/env ruby
 #--
 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
 # All rights reserved.
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/package'
 
@@ -48,7 +46,7 @@
   def test_gem_conflicting
     assert gem('a', '= 1'), "Should load"
 
-    ex = assert_raise Gem::Exception do
+    ex = assert_raises Gem::Exception do
       gem 'a', '= 2'
     end
 
Index: test/rubygems/test_gem_spec_fetcher.rb
===================================================================
--- test/rubygems/test_gem_spec_fetcher.rb	(revision 19940)
+++ test/rubygems/test_gem_spec_fetcher.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/spec_fetcher'
 
Index: test/rubygems/test_gem_dependency_installer.rb
===================================================================
--- test/rubygems/test_gem_dependency_installer.rb	(revision 19940)
+++ test/rubygems/test_gem_dependency_installer.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/dependency_installer'
 
@@ -360,7 +359,7 @@
     Gem.source_index.gems.delete @a1.full_name
 
     Dir.chdir @tempdir do
-      e = assert_raise Gem::InstallError do
+      e = assert_raises Gem::InstallError do
         inst = Gem::DependencyInstaller.new :domain => :local
         inst.install 'b'
       end
@@ -498,7 +497,7 @@
       policy = Gem::Security::HighSecurity
       inst = Gem::DependencyInstaller.new :security_policy => policy
 
-      e = assert_raise Gem::Exception do
+      e = assert_raises Gem::Exception do
         inst.install 'b'
       end
 
@@ -516,8 +515,8 @@
       inst = Gem::DependencyInstaller.new :wrappers => false
       inst.install 'a'
 
-      assert_no_match(%r|This file was generated by RubyGems.|,
-                      File.read(File.join(@gemhome, 'bin', 'a_bin')))
+      refute_match(%r|This file was generated by RubyGems.|,
+                   File.read(File.join(@gemhome, 'bin', 'a_bin')))
     end
   end
 
Index: test/rubygems/test_gem_source_info_cache.rb
===================================================================
--- test/rubygems/test_gem_source_info_cache.rb	(revision 19940)
+++ test/rubygems/test_gem_source_info_cache.rb	(revision 19941)
@@ -1,11 +1,9 @@
-#!/usr/bin/env ruby
 #--
 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
 # All rights reserved.
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/source_info_cache'
 
@@ -49,7 +47,7 @@
     Gem.sources.replace %W[#{@gem_repo}]
 
     use_ui @ui do
-      assert_not_nil Gem::SourceInfoCache.cache
+      refute_nil Gem::SourceInfoCache.cache
       assert_kind_of Gem::SourceInfoCache, Gem::SourceInfoCache.cache
       assert_equal Gem::SourceInfoCache.cache.object_id,
                    Gem::SourceInfoCache.cache.object_id
@@ -68,11 +66,11 @@
     Gem.sources.replace %w[#{@gem_repo}]
 
     use_ui @ui do
-      assert_not_nil Gem::SourceInfoCache.cache
+      refute_nil Gem::SourceInfoCache.cache
       assert_kind_of Gem::SourceInfoCache, Gem::SourceInfoCache.cache
       assert_equal Gem::SourceInfoCache.cache.object_id,
                    Gem::SourceInfoCache.cache.object_id
-      assert_no_match %r|Bulk updating|, @ui.output
+      refute_match %r|Bulk updating|, @ui.output
     end
   end
 
@@ -147,7 +145,7 @@
   def test_cache_data_none_writable
     FileUtils.chmod 0444, @sic.system_cache_file
     FileUtils.chmod 0444, @sic.user_cache_file
-    e = assert_raise RuntimeError do
+    e = assert_raises RuntimeError do
       @sic.cache_data
     end
     assert_equal 'unable to locate a writable cache file', e.message
@@ -202,7 +200,7 @@
   def test_cache_file_none_writable
     FileUtils.chmod 0444, @sic.system_cache_file
     FileUtils.chmod 0444, @sic.user_cache_file
-    e = assert_raise RuntimeError do
+    e = assert_raises RuntimeError do
       @sic.cache_file
     end
     assert_equal 'unable to locate a writable cache file', e.message
Index: test/rubygems/test_gem_gem_path_searcher.rb
===================================================================
--- test/rubygems/test_gem_gem_path_searcher.rb	(revision 19940)
+++ test/rubygems/test_gem_gem_path_searcher.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/gem_path_searcher'
 
Index: test/rubygems/test_gem_commands_generate_index_command.rb
===================================================================
--- test/rubygems/test_gem_commands_generate_index_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_generate_index_command.rb	(revision 19941)
@@ -1,4 +1,4 @@
-require 'test/unit'
+require 'minitest/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/indexer'
 require 'rubygems/commands/generate_index_command'
Index: test/rubygems/test_gem_gem_runner.rb
===================================================================
--- test/rubygems/test_gem_gem_runner.rb	(revision 19940)
+++ test/rubygems/test_gem_gem_runner.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/gem_runner'
 
Index: test/rubygems/test_gem_ext_configure_builder.rb
===================================================================
--- test/rubygems/test_gem_ext_configure_builder.rb	(revision 19940)
+++ test/rubygems/test_gem_ext_configure_builder.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/ext'
 
@@ -41,7 +40,7 @@
     return if RUBY_PLATFORM =~ /mswin/ # HACK
     output = []
 
-    error = assert_raise Gem::InstallError do
+    error = assert_raises Gem::InstallError do
       Dir.chdir @ext do
         Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output
       end
Index: test/rubygems/test_gem_commands_lock_command.rb
===================================================================
--- test/rubygems/test_gem_commands_lock_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_lock_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/lock_command'
 
@@ -56,7 +55,7 @@
   def test_execute_strict
     @cmd.handle_options %w[c-1 --strict]
 
-    e = assert_raise Gem::Exception do
+    e = assert_raises Gem::Exception do
       use_ui @ui do
         @cmd.execute
       end
Index: test/rubygems/test_gem_command_manager.rb
===================================================================
--- test/rubygems/test_gem_command_manager.rb	(revision 19940)
+++ test/rubygems/test_gem_command_manager.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/command_manager'
 
Index: test/rubygems/test_gem_dependency_list.rb
===================================================================
--- test/rubygems/test_gem_dependency_list.rb	(revision 19940)
+++ test/rubygems/test_gem_dependency_list.rb	(revision 19941)
@@ -1,12 +1,9 @@
-#!/usr/bin/env ruby
 #--
 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
 # All rights reserved.
 # See LICENSE.txt for permissions.
 #++
 
-
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/dependency_list'
 
Index: test/rubygems/functional.rb
===================================================================
--- test/rubygems/functional.rb	(revision 19940)
+++ test/rubygems/functional.rb	(revision 19941)
@@ -5,13 +5,14 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require 'rubygems'
+require 'minitest/unit'
 require 'test/insure_session'
 require 'rubygems/format'
 require 'rubygems/command_manager'
 
-class FunctionalTest < Test::Unit::TestCase
+class FunctionalTest < MiniTest::Unit::TestCase
+
   def setup
     @gem_path = File.expand_path("bin/gem")
     lib_path = File.expand_path("lib")
@@ -93,3 +94,6 @@
   end
 
 end
+
+MiniTest::Unit.autorun
+
Index: test/rubygems/test_gem_commands_contents_command.rb
===================================================================
--- test/rubygems/test_gem_commands_contents_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_contents_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/contents_command'
 
@@ -28,7 +27,7 @@
   def test_execute_bad_gem
     @cmd.options[:args] = %w[foo]
 
-    assert_raise MockGemUi::TermError do
+    assert_raises MockGemUi::TermError do
       use_ui @ui do
         @cmd.execute
       end
@@ -71,7 +70,7 @@
     end
 
     assert_match %r|lib/foo\.rb|, @ui.output
-    assert_no_match %r|Rakefile|, @ui.output
+    refute_match %r|Rakefile|, @ui.output
 
     assert_equal "", @ui.error
   end
Index: test/rubygems/test_gem_version_option.rb
===================================================================
--- test/rubygems/test_gem_version_option.rb	(revision 19940)
+++ test/rubygems/test_gem_version_option.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/command'
 require 'rubygems/version_option'
Index: test/rubygems/test_gem_commands_build_command.rb
===================================================================
--- test/rubygems/test_gem_commands_build_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_build_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/build_command'
 require 'rubygems/format'
Index: test/rubygems/test_gem_commands_environment_command.rb
===================================================================
--- test/rubygems/test_gem_commands_environment_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_environment_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/environment_command'
 
@@ -109,7 +108,7 @@
   def test_execute_unknown
     @cmd.send :handle_options, %w[unknown]
 
-    assert_raise Gem::CommandLineError do
+    assert_raises Gem::CommandLineError do
       use_ui @ui do
         @cmd.execute
       end
Index: test/rubygems/test_gem_builder.rb
===================================================================
--- test/rubygems/test_gem_builder.rb	(revision 19940)
+++ test/rubygems/test_gem_builder.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/builder'
 
Index: test/rubygems/test_gem_commands_stale_command.rb
===================================================================
--- test/rubygems/test_gem_commands_stale_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_stale_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/stale_command'
 
Index: test/rubygems/gem_installer_test_case.rb
===================================================================
--- test/rubygems/gem_installer_test_case.rb	(revision 19940)
+++ test/rubygems/gem_installer_test_case.rb	(revision 19941)
@@ -1,4 +1,4 @@
-require 'test/unit'
+require 'minitest/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/installer'
 
Index: test/rubygems/test_gem_stream_ui.rb
===================================================================
--- test/rubygems/test_gem_stream_ui.rb	(revision 19940)
+++ test/rubygems/test_gem_stream_ui.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/user_interaction'
 
Index: test/rubygems/test_gem_remote_fetcher.rb
===================================================================
--- test/rubygems/test_gem_remote_fetcher.rb	(revision 19940)
+++ test/rubygems/test_gem_remote_fetcher.rb	(revision 19941)
@@ -1,11 +1,9 @@
-#!/usr/bin/env ruby
 #--
 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
 # All rights reserved.
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'webrick'
 require 'zlib'
@@ -111,9 +109,14 @@
     @fetcher = Gem::RemoteFetcher.fetcher
   end
 
+  def teardown
+    super
+    Gem.configuration[:http_proxy] = nil
+  end
+
   def test_self_fetcher
     fetcher = Gem::RemoteFetcher.fetcher
-    assert_not_nil fetcher
+    refute_nil fetcher
     assert_kind_of Gem::RemoteFetcher, fetcher
   end
 
@@ -124,7 +127,7 @@
 
     fetcher = Gem::RemoteFetcher.fetcher
 
-    assert_not_nil fetcher
+    refute_nil fetcher
     assert_kind_of Gem::RemoteFetcher, fetcher
     assert_equal proxy_uri, fetcher.instance_variable_get(:@proxy_uri).to_s
   end
@@ -132,8 +135,11 @@
   def test_self_fetcher_with_proxy_URI
     proxy_uri = URI.parse 'http://proxy.example.com'
     Gem.configuration[:http_proxy] = proxy_uri
+    Gem::RemoteFetcher.fetcher = nil
+
     fetcher = Gem::RemoteFetcher.fetcher
-    assert_not_nil fetcher
+    refute_nil fetcher
+
     assert_kind_of Gem::RemoteFetcher, fetcher
     assert_equal proxy_uri, fetcher.instance_variable_get(:@proxy_uri)
   end
@@ -141,7 +147,7 @@
   def test_fetch_size_bad_uri
     fetcher = Gem::RemoteFetcher.new nil
 
-    e = assert_raise ArgumentError do
+    e = assert_raises ArgumentError do
       fetcher.fetch_size 'gems.example.com/yaml'
     end
 
@@ -155,7 +161,7 @@
     end
 
     uri = 'http://gems.example.com/yaml'
-    e = assert_raise Gem::RemoteFetcher::FetchError do
+    e = assert_raises Gem::RemoteFetcher::FetchError do
       fetcher.fetch_size uri
     end
 
@@ -310,7 +316,7 @@
   def test_download_unsupported
     inst = Gem::RemoteFetcher.fetcher
 
-    e = assert_raise Gem::InstallError do
+    e = assert_raises Gem::InstallError do
       inst.download @a1, 'ftp://gems.rubyforge.org'
     end
 
@@ -408,7 +414,7 @@
       raise EOFError
     end
 
-    e = assert_raise Gem::RemoteFetcher::FetchError do
+    e = assert_raises Gem::RemoteFetcher::FetchError do
       fetcher.fetch_path 'uri'
     end
 
@@ -423,7 +429,7 @@
       raise SocketError
     end
 
-    e = assert_raise Gem::RemoteFetcher::FetchError do
+    e = assert_raises Gem::RemoteFetcher::FetchError do
       fetcher.fetch_path 'uri'
     end
 
@@ -438,7 +444,7 @@
       raise Errno::ECONNREFUSED, 'connect(2)'
     end
 
-    e = assert_raise Gem::RemoteFetcher::FetchError do
+    e = assert_raises Gem::RemoteFetcher::FetchError do
       fetcher.fetch_path 'uri'
     end
 
@@ -546,7 +552,7 @@
     conn = { 'gems.example.com:80' => conn }
     fetcher.instance_variable_set :@connections, conn
 
-    e = assert_raise Gem::RemoteFetcher::FetchError do
+    e = assert_raises Gem::RemoteFetcher::FetchError do
       fetcher.open_uri_or_path 'http://gems.example.com/redirect'
     end
 
Index: test/rubygems/test_gem_package_tar_writer.rb
===================================================================
--- test/rubygems/test_gem_package_tar_writer.rb	(revision 19940)
+++ test/rubygems/test_gem_package_tar_writer.rb	(revision 19941)
@@ -61,7 +61,7 @@
   end
 
   def test_add_file_simple_size
-    assert_raise Gem::Package::TarWriter::FileOverflow do 
+    assert_raises Gem::Package::TarWriter::FileOverflow do 
       @tar_writer.add_file_simple("lib/foo/bar", 0, 10) do |io|
         io.write "1" * 11
       end
@@ -69,7 +69,7 @@
   end
 
   def test_add_file_unseekable
-    assert_raise Gem::Package::NonSeekableIO do 
+    assert_raises Gem::Package::NonSeekableIO do 
       Gem::Package::TarWriter.new(Object.new).add_file 'x', 0
     end
   end
@@ -79,27 +79,27 @@
 
     assert_equal "\0" * 1024, @io.string
 
-    e = assert_raise IOError do
+    e = assert_raises IOError do
       @tar_writer.close
     end
     assert_equal 'closed Gem::Package::TarWriter', e.message
 
-    e = assert_raise IOError do
+    e = assert_raises IOError do
       @tar_writer.flush
     end
     assert_equal 'closed Gem::Package::TarWriter', e.message
 
-    e = assert_raise IOError do
+    e = assert_raises IOError do
       @tar_writer.add_file 'x', 0
     end
     assert_equal 'closed Gem::Package::TarWriter', e.message
 
-    e = assert_raise IOError do
+    e = assert_raises IOError do
       @tar_writer.add_file_simple 'x', 0, 0
     end
     assert_equal 'closed Gem::Package::TarWriter', e.message
 
-    e = assert_raise IOError do
+    e = assert_raises IOError do
       @tar_writer.mkdir 'x', 0
     end
     assert_equal 'closed Gem::Package::TarWriter', e.message
@@ -125,7 +125,7 @@
     name = File.join 'a', 'b' * 100
     assert_equal ['b' * 100, 'a'], @tar_writer.split_name(name)
 
-    assert_raise Gem::Package::TooLongFileName do
+    assert_raises Gem::Package::TooLongFileName do
       name = File.join 'a', 'b' * 101
       @tar_writer.split_name name
     end
@@ -135,14 +135,14 @@
     name = File.join 'a' * 155, 'b'
     assert_equal ['b', 'a' * 155], @tar_writer.split_name(name)
 
-    assert_raise Gem::Package::TooLongFileName do
+    assert_raises Gem::Package::TooLongFileName do
       name = File.join 'a' * 156, 'b'
       @tar_writer.split_name name
     end
   end
 
   def test_split_name_too_long_total
-    assert_raise Gem::Package::TooLongFileName do
+    assert_raises Gem::Package::TooLongFileName do
       @tar_writer.split_name 'a' * 257
     end
   end
Index: test/rubygems/test_gem_commands_sources_command.rb
===================================================================
--- test/rubygems/test_gem_commands_sources_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_sources_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/sources_command'
 
Index: test/rubygems/test_gem_package_tar_reader_entry.rb
===================================================================
--- test/rubygems/test_gem_package_tar_reader_entry.rb	(revision 19940)
+++ test/rubygems/test_gem_package_tar_reader_entry.rb	(revision 19941)
@@ -36,19 +36,19 @@
 
     assert @entry.bytes_read
 
-    e = assert_raise IOError do @entry.eof? end
+    e = assert_raises IOError do @entry.eof? end
     assert_equal 'closed Gem::Package::TarReader::Entry', e.message
 
-    e = assert_raise IOError do @entry.getc end
+    e = assert_raises IOError do @entry.getc end
     assert_equal 'closed Gem::Package::TarReader::Entry', e.message
 
-    e = assert_raise IOError do @entry.pos end
+    e = assert_raises IOError do @entry.pos end
     assert_equal 'closed Gem::Package::TarReader::Entry', e.message
 
-    e = assert_raise IOError do @entry.read end
+    e = assert_raises IOError do @entry.read end
     assert_equal 'closed Gem::Package::TarReader::Entry', e.message
 
-    e = assert_raise IOError do @entry.rewind end
+    e = assert_raises IOError do @entry.rewind end
     assert_equal 'closed Gem::Package::TarReader::Entry', e.message
   end
 
Index: test/rubygems/test_gem_config_file.rb
===================================================================
--- test/rubygems/test_gem_config_file.rb	(revision 19940)
+++ test/rubygems/test_gem_config_file.rb	(revision 19941)
@@ -1,11 +1,9 @@
-#!/usr/bin/env ruby
 #--
 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
 # All rights reserved.
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/config_file'
 
Index: test/rubygems/test_gem_commands_pristine_command.rb
===================================================================
--- test/rubygems/test_gem_commands_pristine_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_pristine_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/pristine_command'
 
@@ -96,7 +95,7 @@
   def test_execute_no_gem
     @cmd.options[:args] = %w[]
 
-    e = assert_raise Gem::CommandLineError do
+    e = assert_raises Gem::CommandLineError do
       use_ui @ui do
         @cmd.execute
       end
Index: test/rubygems/test_gem_digest.rb
===================================================================
--- test/rubygems/test_gem_digest.rb	(revision 19940)
+++ test/rubygems/test_gem_digest.rb	(revision 19941)
@@ -1,44 +1,46 @@
-#!/usr/bin/env ruby
 #--
 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
 # All rights reserved.
 # See LICENSE.txt for permissions.
 #++
 
-require "test/unit"
+require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require "rubygems/digest/md5"
 require "rubygems/digest/sha1"
 require "rubygems/digest/sha2"
 
-class TestRubygemsGemDigest < Test::Unit::TestCase
+class TestRubygemsGemDigest < RubyGemTestCase
+
   def test_sha256_hex_digest_works
     digester = Gem::SHA256.new
     assert_equal "b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78", digester.hexdigest("ABC")
   end
-  
+
   def test_sha256_digest_works
     digester = Gem::SHA256.new
-    assert_equal "\265\324\004\\?Fo\251\037\342\314j\276y#*\032W\315\361\004\367\242nqn\n\036'\211\337x", 
+    assert_equal "\265\324\004\\?Fo\251\037\342\314j\276y#*\032W\315\361\004\367\242nqn\n\036'\211\337x",
       digester.digest("ABC")
   end
-  
+
   def test_sha1_hex_digest_works
     digester = Gem::SHA1.new
     assert_equal "3c01bdbb26f358bab27f267924aa2c9a03fcfdb8", digester.hexdigest("ABC")
   end
-  
+
   def test_sha1_digest_works
     digester = Gem::SHA1.new
     assert_equal "<\001\275\273&\363X\272\262\177&y$\252,\232\003\374\375\270", digester.digest("ABC")
   end
-  
+
   def test_md5_hex_digest_works
     digester = Gem::MD5.new
     assert_equal "902fbdd2b1df0c4f70b4a5d23525e932", digester.hexdigest("ABC")
   end
-  
+
   def test_md5_digest_works
     digester = Gem::MD5.new
     assert_equal "\220/\275\322\261\337\fOp\264\245\3225%\3512", digester.digest("ABC")
   end
-end
\ No newline at end of file
+
+end
+
Index: test/rubygems/test_gem.rb
===================================================================
--- test/rubygems/test_gem.rb	(revision 19940)
+++ test/rubygems/test_gem.rb	(revision 19941)
@@ -65,8 +65,8 @@
 
     assert_equal nil, Gem.instance_variable_get(:@gem_home)
     assert_equal nil, Gem.instance_variable_get(:@gem_path)
-    assert_not_equal searcher, Gem.searcher
-    assert_not_equal source_index.object_id, Gem.source_index.object_id
+    refute_equal searcher, Gem.searcher
+    refute_equal source_index.object_id, Gem.source_index.object_id
   end
 
   def test_self_configuration
@@ -214,10 +214,10 @@
     orig_Gem_ssl_available = Gem.ssl_available?
 
     Gem.ssl_available = true
-    assert_nothing_raised do Gem.ensure_ssl_available end
+    Gem.ensure_ssl_available
 
     Gem.ssl_available = false
-    e = assert_raise Gem::Exception do Gem.ensure_ssl_available end
+    e = assert_raises Gem::Exception do Gem.ensure_ssl_available end
     assert_equal 'SSL is not installed on this system', e.message
   ensure
     Gem.ssl_available = orig_Gem_ssl_available
Index: test/rubygems/test_gem_commands_query_command.rb
===================================================================
--- test/rubygems/test_gem_commands_query_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_query_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/query_command'
 
@@ -99,7 +98,7 @@
   def test_execute_installed
     @cmd.handle_options %w[-n c --installed]
 
-    e = assert_raise Gem::SystemExitException do
+    e = assert_raises Gem::SystemExitException do
       use_ui @ui do
         @cmd.execute
       end
@@ -115,7 +114,7 @@
   def test_execute_installed_no_name
     @cmd.handle_options %w[--installed]
 
-    e = assert_raise Gem::SystemExitException do
+    e = assert_raises Gem::SystemExitException do
       use_ui @ui do
         @cmd.execute
       end
@@ -130,7 +129,7 @@
   def test_execute_installed_not_installed
     @cmd.handle_options %w[-n not_installed --installed]
 
-    e = assert_raise Gem::SystemExitException do
+    e = assert_raises Gem::SystemExitException do
       use_ui @ui do
         @cmd.execute
       end
@@ -145,7 +144,7 @@
   def test_execute_installed_version
     @cmd.handle_options %w[-n c --installed --version 1.2]
 
-    e = assert_raise Gem::SystemExitException do
+    e = assert_raises Gem::SystemExitException do
       use_ui @ui do
         @cmd.execute
       end
@@ -160,7 +159,7 @@
   def test_execute_installed_version_not_installed
     @cmd.handle_options %w[-n c --installed --version 2]
 
-    e = assert_raise Gem::SystemExitException do
+    e = assert_raises Gem::SystemExitException do
       use_ui @ui do
         @cmd.execute
       end
Index: test/rubygems/test_gem_commands_install_command.rb
===================================================================
--- test/rubygems/test_gem_commands_install_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_install_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/install_command'
 
@@ -16,7 +15,7 @@
     @cmd.options[:include_dependencies] = true
     @cmd.options[:args] = []
 
-    assert_raise Gem::CommandLineError do
+    assert_raises Gem::CommandLineError do
       use_ui @ui do
         @cmd.execute
       end
@@ -79,7 +78,7 @@
   def test_execute_no_gem
     @cmd.options[:args] = %w[]
 
-    assert_raise Gem::CommandLineError do
+    assert_raises Gem::CommandLineError do
       @cmd.execute
     end
   end
Index: test/rubygems/test_gem_format.rb
===================================================================
--- test/rubygems/test_gem_format.rb	(revision 19940)
+++ test/rubygems/test_gem_format.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require File.join(File.expand_path(File.dirname(__FILE__)), 'simple_gem')
 require 'rubygems/format'
@@ -36,27 +35,27 @@
   end
 
   def test_from_file_by_path_nonexistent
-    assert_raise Gem::Exception do
+    assert_raises Gem::Exception do
       Gem::Format.from_file_by_path '/nonexistent'
     end
   end
 
   def test_from_io_garbled
-    e = assert_raise Gem::Package::FormatError do
+    e = assert_raises Gem::Package::FormatError do
       # subtly bogus input
       Gem::Format.from_io(StringIO.new(@simple_gem.upcase))
     end
 
     assert_equal 'No metadata found!', e.message
 
-    e = assert_raise Gem::Package::FormatError do
+    e = assert_raises Gem::Package::FormatError do
       # Totally bogus input
       Gem::Format.from_io(StringIO.new(@simple_gem.reverse))
     end
 
     assert_equal 'No metadata found!', e.message
 
-    e = assert_raise Gem::Package::FormatError do
+    e = assert_raises Gem::Package::FormatError do
       # This was intentionally screws up YAML parsing.
       Gem::Format.from_io(StringIO.new(@simple_gem.gsub(/:/, "boom")))
     end
@@ -66,4 +65,3 @@
 
 end
 
-
Index: test/rubygems/test_gem_commands_list_command.rb
===================================================================
--- test/rubygems/test_gem_commands_list_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_list_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/list_command'
 
@@ -21,7 +20,7 @@
   def test_execute_installed
     @cmd.handle_options %w[c --installed]
 
-    e = assert_raise Gem::SystemExitException do
+    e = assert_raises Gem::SystemExitException do
       use_ui @ui do
         @cmd.execute
       end
Index: test/rubygems/test_gem_ext_ext_conf_builder.rb
===================================================================
--- test/rubygems/test_gem_ext_ext_conf_builder.rb	(revision 19940)
+++ test/rubygems/test_gem_ext_ext_conf_builder.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/ext'
 
@@ -55,7 +54,7 @@
 
     output = []
 
-    error = assert_raise Gem::InstallError do
+    error = assert_raises Gem::InstallError do
       Dir.chdir @ext do
         Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
       end
@@ -103,7 +102,7 @@
   end
 
   def test_class_make_no_Makefile
-    error = assert_raise Gem::InstallError do
+    error = assert_raises Gem::InstallError do
       Dir.chdir @ext do
         Gem::Ext::ExtConfBuilder.make @ext, ['output']
       end
Index: test/rubygems/test_gem_commands_check_command.rb
===================================================================
--- test/rubygems/test_gem_commands_check_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_check_command.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/check_command'
 
Index: test/rubygems/test_gem_installer.rb
===================================================================
--- test/rubygems/test_gem_installer.rb	(revision 19940)
+++ test/rubygems/test_gem_installer.rb	(revision 19941)
@@ -52,7 +52,7 @@
   def test_build_extensions_extconf_bad
     @spec.extensions << 'extconf.rb'
 
-    e = assert_raise Gem::Installer::ExtensionBuildError do
+    e = assert_raises Gem::Installer::ExtensionBuildError do
       use_ui @ui do
         @installer.build_extensions
       end
@@ -79,7 +79,7 @@
   def test_build_extensions_unsupported
     @spec.extensions << nil
 
-    e = assert_raise Gem::Installer::ExtensionBuildError do
+    e = assert_raises Gem::Installer::ExtensionBuildError do
       use_ui @ui do
         @installer.build_extensions
       end
@@ -101,7 +101,7 @@
     assert @installer.ensure_dependency(@spec, dep)
 
     dep = Gem::Dependency.new 'b', '> 2'
-    e = assert_raise Gem::InstallError do
+    e = assert_raises Gem::InstallError do
       @installer.ensure_dependency @spec, dep
     end
 
@@ -142,7 +142,7 @@
   def test_extract_files_bad_dest
     @installer.gem_dir = 'somedir'
     @installer.format = nil
-    e = assert_raise ArgumentError do
+    e = assert_raises ArgumentError do
       @installer.extract_files
     end
 
@@ -157,7 +157,7 @@
 
     @installer.format = format
 
-    e = assert_raise Gem::InstallError do
+    e = assert_raises Gem::InstallError do
       @installer.extract_files
     end
 
@@ -175,7 +175,7 @@
 
     @installer.format = format
 
-    e = assert_raise Gem::InstallError do
+    e = assert_raises Gem::InstallError do
       @installer.extract_files
     end
 
@@ -342,8 +342,8 @@
 
     assert_match %r|generated by RubyGems|, File.read(installed_exec)
 
-    assert_no_match %r|generated by RubyGems|, File.read(real_exec),
-                    'real executable overwritten'
+    refute_match %r|generated by RubyGems|, File.read(real_exec),
+                 'real executable overwritten'
   end
 
   def test_generate_bin_symlink
@@ -581,7 +581,7 @@
     gem_data = File.open gem, 'rb' do |fp| fp.read 1024 end
     File.open gem, 'wb' do |fp| fp.write gem_data end
 
-    e = assert_raise Gem::InstallError do
+    e = assert_raises Gem::InstallError do
       use_ui @ui do
         @installer = Gem::Installer.new gem
         @installer.install
@@ -596,7 +596,7 @@
     util_setup_gem
 
     use_ui @ui do
-      assert_raise Gem::InstallError do
+      assert_raises Gem::InstallError do
         @installer.install
       end
     end
@@ -739,7 +739,7 @@
   def test_install_wrong_ruby_version
     use_ui @ui do
       installer = Gem::Installer.new old_ruby_required
-      e = assert_raise Gem::InstallError do
+      e = assert_raises Gem::InstallError do
         installer.install
       end
       assert_equal 'old_ruby_required requires Ruby version = 1.4.6',
@@ -758,7 +758,7 @@
 
     use_ui @ui do
       @installer = Gem::Installer.new gem
-      e = assert_raise Gem::InstallError do
+      e = assert_raises Gem::InstallError do
         @installer.install
       end
       assert_equal 'old_rubygems_required requires RubyGems version < 0',
Index: test/rubygems/test_gem_commands_specification_command.rb
===================================================================
--- test/rubygems/test_gem_commands_specification_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_specification_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/specification_command'
 
@@ -46,7 +45,7 @@
   def test_execute_bad_name
     @cmd.options[:args] = %w[foo]
 
-    assert_raise MockGemUi::TermError do
+    assert_raises MockGemUi::TermError do
       use_ui @ui do
         @cmd.execute
       end
Index: test/rubygems/test_gem_requirement.rb
===================================================================
--- test/rubygems/test_gem_requirement.rb	(revision 19940)
+++ test/rubygems/test_gem_requirement.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/version'
 
@@ -32,19 +31,19 @@
     assert_equal @r1_2, @r1_2.dup
     assert_equal @r1_2.dup, @r1_2
 
-    assert_not_equal @r1_3, @r1_2
-    assert_not_equal @r1_2, @r1_3
+    refute_equal @r1_3, @r1_2
+    refute_equal @r1_2, @r1_3
 
-    assert_not_equal Object.new, @r1_2
-    assert_not_equal @r1_2, Object.new
+    refute_equal Object.new, @r1_2
+    refute_equal @r1_2, Object.new
   end
 
   def test_hash
     assert_equal @r1_2.hash, @r1_2.dup.hash
     assert_equal @r1_2.dup.hash, @r1_2.hash
 
-    assert_not_equal @r1_2.hash, @r1_3.hash
-    assert_not_equal @r1_3.hash, @r1_2.hash
+    refute_equal @r1_2.hash, @r1_3.hash
+    refute_equal @r1_3.hash, @r1_2.hash
   end
 
   # We may get some old gems that have requirements in old formats.
@@ -80,13 +79,13 @@
   end
 
   def test_parse_illformed
-    e = assert_raise ArgumentError do
+    e = assert_raises ArgumentError do
       @r1_2.parse(nil)
     end
 
     assert_equal 'Illformed requirement [nil]', e.message
 
-    e = assert_raise ArgumentError do
+    e = assert_raises ArgumentError do
       @r1_2.parse('')
     end
 
@@ -139,7 +138,7 @@
     assert_equal false, r1_2.satisfied_by?(v1_2)
     assert_equal true,  r1_2.satisfied_by?(v1_3)
 
-    assert_raise NoMethodError do
+    assert_raises NoMethodError do
       assert_equal true,  r1_2.satisfied_by?(nil)
     end
   end
@@ -154,7 +153,7 @@
     assert_equal true,  r1_2.satisfied_by?(v1_2)
     assert_equal true,  r1_2.satisfied_by?(v1_3)
 
-    assert_raise NoMethodError do
+    assert_raises NoMethodError do
       assert_equal true,  r1_2.satisfied_by?(nil)
     end
   end
@@ -169,7 +168,7 @@
     assert_equal true,  r.satisfied_by?(v1_2)
     assert_equal false, r.satisfied_by?(v1_3)
 
-    assert_raise NoMethodError do
+    assert_raises NoMethodError do
       assert_equal true,  r.satisfied_by?(nil)
     end
   end
@@ -184,7 +183,7 @@
     assert_equal false, r1_2.satisfied_by?(v1_2)
     assert_equal false, r1_2.satisfied_by?(v1_3)
 
-    assert_raise NoMethodError do
+    assert_raises NoMethodError do
       assert_equal true,  r1_2.satisfied_by?(nil)
     end
   end
@@ -199,7 +198,7 @@
     assert_equal true,  r1_2.satisfied_by?(v1_2)
     assert_equal false, r1_2.satisfied_by?(v1_3)
 
-    assert_raise NoMethodError do
+    assert_raises NoMethodError do
       assert_equal true,  r1_2.satisfied_by?(nil)
     end
   end
@@ -214,7 +213,7 @@
     assert_equal true,  r1_2.satisfied_by?(v1_2)
     assert_equal true,  r1_2.satisfied_by?(v1_3)
 
-    assert_raise NoMethodError do
+    assert_raises NoMethodError do
       assert_equal true,  r1_2.satisfied_by?(nil)
     end
   end
Index: test/rubygems/test_gem_ext_rake_builder.rb
===================================================================
--- test/rubygems/test_gem_ext_rake_builder.rb	(revision 19940)
+++ test/rubygems/test_gem_ext_rake_builder.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/ext'
 
@@ -41,7 +40,7 @@
       "(in #{realdir})\n"
     ]
 
-    assert_no_match %r%^rake failed:%, output
+    refute_match %r%^rake failed:%, output
     assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, output
     assert_match %r%^#{Regexp.escape @@rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, output
   end
@@ -57,7 +56,7 @@
 
     output = []
 
-    error = assert_raise Gem::InstallError do
+    error = assert_raises Gem::InstallError do
       build_rake_in do
         Dir.chdir @ext do
           Gem::Ext::RakeBuilder.build "mkrf_conf.rb", nil, @dest_path, output
Index: test/rubygems/test_config.rb
===================================================================
--- test/rubygems/test_config.rb	(revision 19940)
+++ test/rubygems/test_config.rb	(revision 19941)
@@ -1,11 +1,9 @@
-#!/usr/bin/env ruby
 #--
 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
 # All rights reserved.
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rbconfig'
 require 'rubygems'
Index: test/rubygems/gemutilities.rb
===================================================================
--- test/rubygems/gemutilities.rb	(revision 19940)
+++ test/rubygems/gemutilities.rb	(revision 19941)
@@ -1,4 +1,3 @@
-#!/usr/bin/env ruby
 #--
 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
 # All rights reserved.
@@ -9,8 +8,14 @@
 
 $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
 
+require 'rubygems'
 require 'fileutils'
-require 'test/unit'
+begin
+  require 'minitest/unit'
+rescue LoadError
+  warn "Install minitest gem"
+  raise
+end
 require 'tmpdir'
 require 'uri'
 require 'rubygems/package'
@@ -36,7 +41,7 @@
   end
 end
 
-class RubyGemTestCase < Test::Unit::TestCase
+class RubyGemTestCase < MiniTest::Unit::TestCase
 
   include Gem::DefaultUserInteraction
 
@@ -430,8 +435,6 @@
     Gem.module_eval {@ruby = ruby}
     env_rake = ENV["rake"]
     ENV["rake"] = @@rake
-    argv = ARGV.dup
-    ARGV.clear
     yield @@rake
   ensure
     Gem.module_eval {@ruby = gem_ruby}
@@ -440,7 +443,6 @@
     else
       ENV.delete("rake")
     end
-    ARGV.replace(argv) if argv
   end
 
   def self.rubybin
@@ -482,3 +484,5 @@
 
 end
 
+MiniTest::Unit.autorun
+
Index: test/rubygems/test_gem_command.rb
===================================================================
--- test/rubygems/test_gem_command.rb	(revision 19940)
+++ test/rubygems/test_gem_command.rb	(revision 19941)
@@ -5,7 +5,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/command'
 
@@ -63,7 +62,7 @@
 
     assert_match %r|-x, --zip|, @cmd.parser.to_s
     assert_match %r|-z, --exe|, @cmd.parser.to_s
-    assert_no_match %r|-x, --exe|, @cmd.parser.to_s
+    refute_match %r|-x, --exe|, @cmd.parser.to_s
   end
 
   def test_basic_accessors
@@ -109,7 +108,7 @@
     use_ui @ui do
       @cmd.when_invoked do true end
 
-      ex = assert_raise(OptionParser::InvalidOption) do
+      ex = assert_raises OptionParser::InvalidOption do
         @cmd.invoke('-zzz')
       end
 
Index: test/rubygems/test_gem_source_info_cache_entry.rb
===================================================================
--- test/rubygems/test_gem_source_info_cache_entry.rb	(revision 19940)
+++ test/rubygems/test_gem_source_info_cache_entry.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/source_info_cache_entry'
 
@@ -56,7 +55,7 @@
   end
 
   def test_refresh_bad_uri
-    assert_raise URI::BadURIError do
+    assert_raises URI::BadURIError do
       @sic_e.refresh 'gems.example.com', true
     end
   end
Index: test/rubygems/test_gem_platform.rb
===================================================================
--- test/rubygems/test_gem_platform.rb	(revision 19940)
+++ test/rubygems/test_gem_platform.rb	(revision 19941)
@@ -1,5 +1,4 @@
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
-require 'test/unit'
 require 'rubygems/platform'
 require 'rbconfig'
 
@@ -147,8 +146,8 @@
     other = Gem::Platform.new %w[cpu other_platform 1]
 
     assert_equal my, my
-    assert_not_equal my, other
-    assert_not_equal other, my
+    refute_equal my, other
+    refute_equal other, my
   end
 
   def test_equals3
@@ -205,10 +204,10 @@
     # oddballs
     assert_match 'i386-mswin32-mq5.3', Gem::Platform.local
     assert_match 'i386-mswin32-mq6',   Gem::Platform.local
-    deny_match   'win32-1.8.2-VC7',    Gem::Platform.local
-    deny_match   'win32-1.8.4-VC6',    Gem::Platform.local
-    deny_match   'win32-source',       Gem::Platform.local
-    deny_match   'windows',            Gem::Platform.local
+    refute_match 'win32-1.8.2-VC7',    Gem::Platform.local
+    refute_match 'win32-1.8.4-VC6',    Gem::Platform.local
+    refute_match 'win32-source',       Gem::Platform.local
+    refute_match 'windows',            Gem::Platform.local
 
     util_set_arch 'i686-linux'
     assert_match 'i486-linux', Gem::Platform.local
@@ -236,17 +235,5 @@
     assert_match 'sparc-solaris2.8-mq5.3', Gem::Platform.local
   end
 
-  def assert_match(pattern, platform, message = '')
-    full_message = build_message message, "<?> expected to be =~\n<?>.",
-                                 platform, pattern
-    assert_block(full_message) { platform =~ pattern }
-  end
-
-  def deny_match(pattern, platform, message = '')
-    full_message = build_message message, "<?> expected to be !~\n<?>.",
-                                 platform, pattern
-    assert_block(full_message) { platform !~ pattern }
-  end
-
 end
 
Index: test/rubygems/test_gem_commands_server_command.rb
===================================================================
--- test/rubygems/test_gem_commands_server_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_server_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/server_command'
 
Index: test/rubygems/test_gem_validator.rb
===================================================================
--- test/rubygems/test_gem_validator.rb	(revision 19940)
+++ test/rubygems/test_gem_validator.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require File.join(File.expand_path(File.dirname(__FILE__)), 'simple_gem')
 require 'rubygems/validator'
@@ -26,7 +25,7 @@
   end
 
   def test_verify_gem_file_empty
-    e = assert_raise Gem::VerificationError do
+    e = assert_raises Gem::VerificationError do
       @validator.verify_gem_file ''
     end
 
@@ -35,7 +34,7 @@
 
   def test_verify_gem_file_nonexistent
     file = '/nonexistent/nonexistent.gem'
-    e = assert_raise Gem::VerificationError do
+    e = assert_raises Gem::VerificationError do
       @validator.verify_gem_file file
     end
 
@@ -47,7 +46,7 @@
   end
 
   def test_verify_gem_empty
-    e = assert_raise Gem::VerificationError do
+    e = assert_raises Gem::VerificationError do
       @validator.verify_gem ''
     end
 
@@ -55,7 +54,7 @@
   end
 
   def test_verify_gem_invalid_checksum
-    e = assert_raise Gem::VerificationError do
+    e = assert_raises Gem::VerificationError do
       @validator.verify_gem @simple_gem.upcase
     end
 
Index: test/rubygems/test_gem_source_index.rb
===================================================================
--- test/rubygems/test_gem_source_index.rb	(revision 19940)
+++ test/rubygems/test_gem_source_index.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/source_index'
 require 'rubygems/config_file'
@@ -150,7 +149,7 @@
     end
 
     use_ui @ui do
-      assert_raise Interrupt do
+      assert_raises Interrupt do
         Gem::SourceIndex.load_specification(spec_file)
       end
     end
@@ -192,7 +191,7 @@
     end
 
     use_ui @ui do
-      assert_raise SystemExit do
+      assert_raises SystemExit do
         Gem::SourceIndex.load_specification(spec_file)
       end
     end
@@ -232,7 +231,7 @@
     @fetcher.data["#{@gem_repo}yaml.Z"] = proc { raise SocketError }
     @fetcher.data["#{@gem_repo}yaml"] = proc { raise SocketError }
 
-    e = assert_raise Gem::RemoteSourceException do
+    e = assert_raises Gem::RemoteSourceException do
       use_ui @ui do
         @source_index.fetch_bulk_index @uri
       end
@@ -357,7 +356,7 @@
     @fetcher.data["#{@gem_repo}quick/index.rz"] =
       proc { raise Exception }
 
-    e = assert_raise Gem::OperationNotSupportedError do
+    e = assert_raises Gem::OperationNotSupportedError do
       @source_index.fetch_quick_index @uri, true
     end
 
@@ -613,7 +612,7 @@
   def test_refresh_bang_not_from_dir
     source_index = Gem::SourceIndex.new
 
-    e = assert_raise RuntimeError do
+    e = assert_raises RuntimeError do
       source_index.refresh!
     end
 
Index: test/rubygems/test_gem_commands_outdated_command.rb
===================================================================
--- test/rubygems/test_gem_commands_outdated_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_outdated_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/outdated_command'
 
Index: test/rubygems/test_gem_commands_mirror_command.rb
===================================================================
--- test/rubygems/test_gem_commands_mirror_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_mirror_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/indexer'
 require 'rubygems/commands/mirror_command'
Index: test/rubygems/test_gem_commands_dependency_command.rb
===================================================================
--- test/rubygems/test_gem_commands_dependency_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_dependency_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/dependency_command'
 
@@ -61,7 +60,7 @@
   def test_execute_no_match
     @cmd.options[:args] = %w[foo]
 
-    assert_raise MockGemUi::TermError do
+    assert_raises MockGemUi::TermError do
       use_ui @ui do
         @cmd.execute
       end
@@ -146,7 +145,7 @@
     @cmd.options[:reverse_dependencies] = true
     @cmd.options[:domain] = :remote
 
-    assert_raise MockGemUi::TermError do
+    assert_raises MockGemUi::TermError do
       use_ui @ui do
         @cmd.execute
       end
Index: test/rubygems/test_gem_indexer.rb
===================================================================
--- test/rubygems/test_gem_indexer.rb	(revision 19940)
+++ test/rubygems/test_gem_indexer.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 
 require 'rubygems/indexer'
@@ -217,8 +216,8 @@
     assert_same specs[0].last, specs[1].last,
                 'identical platforms not identical'
 
-    assert_not_same specs[1][1], specs[5][1],
-                    'different versions not different'
+    refute_same specs[1][1], specs[5][1],
+                'different versions not different'
   end
 
   def test_generate_index_latest_specs
Index: test/rubygems/test_gem_doc_manager.rb
===================================================================
--- test/rubygems/test_gem_doc_manager.rb	(revision 19940)
+++ test/rubygems/test_gem_doc_manager.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/doc_manager'
 
@@ -21,7 +20,7 @@
     orig_mode = File.stat(@spec.installation_path).mode
     File.chmod 0, @spec.installation_path
 
-    assert_raise Gem::FilePermissionError do
+    assert_raises Gem::FilePermissionError do
       @manager.uninstall_doc
     end
   ensure
Index: test/rubygems/test_gem_commands_unpack_command.rb
===================================================================
--- test/rubygems/test_gem_commands_unpack_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_unpack_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/unpack_command'
 
Index: test/rubygems/test_gem_commands_update_command.rb
===================================================================
--- test/rubygems/test_gem_commands_update_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_update_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/commands/update_command'
 
Index: test/rubygems/test_gem_server.rb
===================================================================
--- test/rubygems/test_gem_server.rb	(revision 19940)
+++ test/rubygems/test_gem_server.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/server'
 require 'stringio'
Index: test/rubygems/test_gem_commands_fetch_command.rb
===================================================================
--- test/rubygems/test_gem_commands_fetch_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_fetch_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/package'
 require 'rubygems/security'
Index: test/rubygems/test_gem_commands_cert_command.rb
===================================================================
--- test/rubygems/test_gem_commands_cert_command.rb	(revision 19940)
+++ test/rubygems/test_gem_commands_cert_command.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 
 require 'rubygems/commands/cert_command'
Index: test/rubygems/test_gem_dependency.rb
===================================================================
--- test/rubygems/test_gem_dependency.rb	(revision 19940)
+++ test/rubygems/test_gem_dependency.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/version'
 
@@ -70,7 +69,7 @@
   end
 
   def test_type_is_restricted
-    assert_raise(ArgumentError) do
+    assert_raises ArgumentError do
       Gem::Dependency.new("pkg", [:sometimes])
     end
   end
@@ -79,21 +78,21 @@
     assert_equal @pkg1_0, @pkg1_0.dup
     assert_equal @pkg1_0.dup, @pkg1_0
 
-    assert_not_equal @pkg1_0, @pkg1_1, "requirements different"
-    assert_not_equal @pkg1_1, @pkg1_0, "requirements different"
+    refute_equal @pkg1_0, @pkg1_1, "requirements different"
+    refute_equal @pkg1_1, @pkg1_0, "requirements different"
 
-    assert_not_equal @pkg1_0, @oth1_0, "names different"
-    assert_not_equal @oth1_0, @pkg1_0, "names different"
+    refute_equal @pkg1_0, @oth1_0, "names different"
+    refute_equal @oth1_0, @pkg1_0, "names different"
 
-    assert_not_equal @pkg1_0, Object.new
-    assert_not_equal Object.new, @pkg1_0
+    refute_equal @pkg1_0, Object.new
+    refute_equal Object.new, @pkg1_0
   end
 
   def test_equals2_type
     runtime = Gem::Dependency.new("pkg", [])
     development = Gem::Dependency.new("pkg", [], :development)
 
-    assert_not_equal(runtime, development)
+    refute_equal(runtime, development)
   end
 
   def test_equals_tilde
@@ -123,18 +122,18 @@
     assert_equal @pkg1_0.hash, @pkg1_0.dup.hash
     assert_equal @pkg1_0.dup.hash, @pkg1_0.hash
 
-    assert_not_equal @pkg1_0.hash, @pkg1_1.hash, "requirements different"
-    assert_not_equal @pkg1_1.hash, @pkg1_0.hash, "requirements different"
+    refute_equal @pkg1_0.hash, @pkg1_1.hash, "requirements different"
+    refute_equal @pkg1_1.hash, @pkg1_0.hash, "requirements different"
 
-    assert_not_equal @pkg1_0.hash, @oth1_0.hash, "names different"
-    assert_not_equal @oth1_0.hash, @pkg1_0.hash, "names different"
+    refute_equal @pkg1_0.hash, @oth1_0.hash, "names different"
+    refute_equal @oth1_0.hash, @pkg1_0.hash, "names different"
   end
 
   def test_hash_type
     runtime = Gem::Dependency.new("pkg", [])
     development = Gem::Dependency.new("pkg", [], :development)
 
-    assert_not_equal(runtime.hash, development.hash)
+    refute_equal(runtime.hash, development.hash)
   end
 end
 
Index: test/rubygems/test_gem_local_remote_options.rb
===================================================================
--- test/rubygems/test_gem_local_remote_options.rb	(revision 19940)
+++ test/rubygems/test_gem_local_remote_options.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/local_remote_options'
 require 'rubygems/command'
@@ -86,7 +85,7 @@
 
     s1 = 'htp://more-gems.example.com'
 
-    assert_raise OptionParser::InvalidArgument do
+    assert_raises OptionParser::InvalidArgument do
       @cmd.handle_options %W[--source #{s1}]
     end
 
Index: test/rubygems/test_gem_specification.rb
===================================================================
--- test/rubygems/test_gem_specification.rb	(revision 19940)
+++ test/rubygems/test_gem_specification.rb	(revision 19941)
@@ -5,7 +5,6 @@
 #++
 
 require 'stringio'
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/specification'
 
@@ -336,8 +335,8 @@
   def test_equals2
     assert_equal @a1, @a1
     assert_equal @a1, @a1.dup
-    assert_not_equal @a1, @a2
-    assert_not_equal @a1, Object.new
+    refute_equal @a1, @a2
+    refute_equal @a1, Object.new
   end
 
   # The cgikit specification was reported to be causing trouble in at least
@@ -369,16 +368,16 @@
     spec = @a1.dup
     spec.default_executable = 'xx'
 
-    assert_not_equal @a1, spec
-    assert_not_equal spec, @a1
+    refute_equal @a1, spec
+    refute_equal spec, @a1
   end
 
   def test_equals2_extensions
     spec = @a1.dup
     spec.extensions = 'xx'
 
-    assert_not_equal @a1, spec
-    assert_not_equal spec, @a1
+    refute_equal @a1, spec
+    refute_equal spec, @a1
   end
 
   def test_executables
@@ -506,7 +505,7 @@
   def test_hash
     assert_equal @a1.hash, @a1.hash
     assert_equal @a1.hash, @a1.dup.hash
-    assert_not_equal @a1.hash, @a2.hash
+    refute_equal @a1.hash, @a2.hash
   end
 
   def test_lib_files
@@ -815,7 +814,7 @@
 
       @a1.authors = [Object.new]
 
-      e = assert_raise Gem::InvalidSpecificationException do
+      e = assert_raises Gem::InvalidSpecificationException do
         @a1.validate
       end
 
@@ -849,7 +848,7 @@
   end
 
   def test_validate_empty
-    e = assert_raise Gem::InvalidSpecificationException do
+    e = assert_raises Gem::InvalidSpecificationException do
       Gem::Specification.new.validate
     end
 
@@ -872,7 +871,7 @@
 
   def test_validate_empty_require_paths
     @a1.require_paths = []
-    e = assert_raise Gem::InvalidSpecificationException do
+    e = assert_raises Gem::InvalidSpecificationException do
       @a1.validate
     end
 
@@ -932,7 +931,7 @@
 
   def test_validate_rubygems_version
     @a1.rubygems_version = "3"
-    e = assert_raise Gem::InvalidSpecificationException do
+    e = assert_raises Gem::InvalidSpecificationException do
       @a1.validate
     end
 
Index: test/rubygems/test_gem_install_update_options.rb
===================================================================
--- test/rubygems/test_gem_install_update_options.rb	(revision 19940)
+++ test/rubygems/test_gem_install_update_options.rb	(revision 19941)
@@ -1,4 +1,3 @@
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require File.join(File.expand_path(File.dirname(__FILE__)),
                   'gem_installer_test_case')
@@ -31,7 +30,7 @@
   def test_security_policy_unknown
     @cmd.add_install_update_options
 
-    assert_raise OptionParser::InvalidArgument do
+    assert_raises OptionParser::InvalidArgument do
       @cmd.handle_options %w[-P UnknownSecurity]
     end
   end
Index: test/rubygems/test_gem_version.rb
===================================================================
--- test/rubygems/test_gem_version.rb	(revision 19940)
+++ test/rubygems/test_gem_version.rb	(revision 19941)
@@ -4,7 +4,6 @@
 # See LICENSE.txt for permissions.
 #++
 
-require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
 require 'rubygems/version'
 
@@ -29,10 +28,10 @@
   end
 
   def test_class_create_malformed
-    e = assert_raise ArgumentError do Gem::Version.create("junk") end
+    e = assert_raises ArgumentError do Gem::Version.create("junk") end
     assert_equal "Malformed version number string junk", e.message
 
-    e = assert_raise ArgumentError do Gem::Version.create("1.0\n2.0") end
+    e = assert_raises ArgumentError do Gem::Version.create("1.0\n2.0") end
     assert_equal "Malformed version number string 1.0\n2.0", e.message
   end
 
@@ -90,8 +89,8 @@
     assert_equal v, @v1_2
     assert_equal @v1_2, v
 
-    assert_not_equal @v1_2, @v1_3
-    assert_not_equal @v1_3, @v1_2
+    refute_equal @v1_2, @v1_3
+    refute_equal @v1_3, @v1_2
   end
 
   def test_hash
@@ -100,16 +99,16 @@
 
     assert_equal v1_2.hash, @v1_2.hash
 
-    assert_not_equal v1_2_0.hash, @v1_2.hash
+    refute_equal v1_2_0.hash, @v1_2.hash
 
-    assert_not_equal @v1_2.hash, @v1_3.hash
+    refute_equal @v1_2.hash, @v1_3.hash
   end
 
   def test_illformed_requirements
     [ ">>> 1.3.5", "> blah" ].each do |rq|
-      assert_raises(ArgumentError, "req [#{rq}] should fail") {
-        Gem::Version::Requirement.new(rq)
-      }
+      assert_raises ArgumentError, "req [#{rq}] should fail" do
+        Gem::Version::Requirement.new rq
+      end
     end
   end
 

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

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