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

ruby-changes:44204

From: nobu <ko1@a...>
Date: Wed, 28 Sep 2016 09:58:03 +0900 (JST)
Subject: [ruby-changes:44204] nobu:r56277 (trunk): rubygems 2.6.7

nobu	2016-09-28 09:57:53 +0900 (Wed, 28 Sep 2016)

  New Revision: 56277

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56277

  Log:
    rubygems 2.6.7
    
    * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update
      rubygems to 2.6.7.
      Release note of 2.6.7: https://github.com/rubygems/rubygems/commit/60f35bd1d2359fc30301d2d4cd72bc6833e8d12a

  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/commands/owner_command.rb
    trunk/lib/rubygems/commands/push_command.rb
    trunk/lib/rubygems/commands/query_command.rb
    trunk/lib/rubygems/commands/setup_command.rb
    trunk/lib/rubygems/commands/yank_command.rb
    trunk/lib/rubygems/config_file.rb
    trunk/lib/rubygems/core_ext/kernel_require.rb
    trunk/lib/rubygems/exceptions.rb
    trunk/lib/rubygems/installer.rb
    trunk/lib/rubygems/remote_fetcher.rb
    trunk/lib/rubygems/request_set.rb
    trunk/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb
    trunk/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb
    trunk/lib/rubygems/resolver.rb
    trunk/lib/rubygems/source.rb
    trunk/lib/rubygems/spec_fetcher.rb
    trunk/lib/rubygems/test_case.rb
    trunk/lib/rubygems/user_interaction.rb
    trunk/lib/rubygems/version.rb
    trunk/lib/rubygems.rb
    trunk/test/rubygems/test_gem.rb
    trunk/test/rubygems/test_gem_commands_query_command.rb
    trunk/test/rubygems/test_gem_commands_setup_command.rb
    trunk/test/rubygems/test_gem_config_file.rb
    trunk/test/rubygems/test_gem_installer.rb
    trunk/test/rubygems/test_gem_remote_fetcher.rb
    trunk/test/rubygems/test_gem_resolver.rb
    trunk/test/rubygems/test_gem_source.rb
    trunk/test/rubygems/test_gem_spec_fetcher.rb
    trunk/test/rubygems/test_gem_version.rb
Index: test/rubygems/test_gem_resolver.rb
===================================================================
--- test/rubygems/test_gem_resolver.rb	(revision 56276)
+++ test/rubygems/test_gem_resolver.rb	(revision 56277)
@@ -683,6 +683,32 @@ class TestGemResolver < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_resolver.rb#L683
     assert_resolves_to [b1, c1, d2], r
   end
 
+  def test_sorts_by_source_then_version
+    sourceA = Gem::Source.new 'http://example.com/a'
+    sourceB = Gem::Source.new 'http://example.com/b'
+    sourceC = Gem::Source.new 'http://example.com/c'
+
+    spec_A_1 = new_spec 'some-dep', '0.0.1'
+    spec_A_2 = new_spec 'some-dep', '1.0.0'
+    spec_B_1 = new_spec 'some-dep', '0.0.1'
+    spec_B_2 = new_spec 'some-dep', '0.0.2'
+    spec_C_1 = new_spec 'some-dep', '0.1.0'
+
+    set = StaticSet.new [
+      Gem::Resolver::SpecSpecification.new(nil, spec_B_1, sourceB),
+      Gem::Resolver::SpecSpecification.new(nil, spec_B_2, sourceB),
+      Gem::Resolver::SpecSpecification.new(nil, spec_C_1, sourceC),
+      Gem::Resolver::SpecSpecification.new(nil, spec_A_2, sourceA),
+      Gem::Resolver::SpecSpecification.new(nil, spec_A_1, sourceA),
+    ]
+
+    dependency = make_dep 'some-dep', '> 0'
+
+    resolver = Gem::Resolver.new [dependency], set
+
+    assert_resolves_to [spec_B_2], resolver
+  end
+
   def test_select_local_platforms
     r = Gem::Resolver.new nil, nil
 
Index: test/rubygems/test_gem_spec_fetcher.rb
===================================================================
--- test/rubygems/test_gem_spec_fetcher.rb	(revision 56276)
+++ test/rubygems/test_gem_spec_fetcher.rb	(revision 56277)
@@ -169,6 +169,26 @@ class TestGemSpecFetcher < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_spec_fetcher.rb#L169
     assert_equal "bad news from the internet (#{@gem_repo})", sfp.error.message
   end
 
+  def test_suggest_gems_from_name_latest
+    spec_fetcher do|fetcher|
+      fetcher.spec 'example', 1
+      fetcher.spec 'other-example', 1
+    end
+
+    suggestions = @sf.suggest_gems_from_name('examplw')
+    assert_equal ['example'], suggestions
+  end
+
+  def test_suggest_gems_from_name_prerelease
+    spec_fetcher do|fetcher|
+      fetcher.spec 'example', '1.a'
+      fetcher.spec 'other-example', 1
+    end
+
+    suggestions = @sf.suggest_gems_from_name('examplw')
+    assert_equal ['example'], suggestions
+  end
+
   def test_available_specs_latest
     spec_fetcher do |fetcher|
       fetcher.spec 'a', 1
Index: test/rubygems/test_gem_remote_fetcher.rb
===================================================================
--- test/rubygems/test_gem_remote_fetcher.rb	(revision 56276)
+++ test/rubygems/test_gem_remote_fetcher.rb	(revision 56277)
@@ -687,6 +687,23 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_remote_fetcher.rb#L687
     assert_equal "too many redirects (#{url})", e.message
   end
 
+  def test_fetch_http_redirects_without_location
+    fetcher = Gem::RemoteFetcher.new nil
+    @fetcher = fetcher
+    url = 'http://gems.example.com/redirect'
+
+    def fetcher.request(uri, request_class, last_modified = nil)
+      res = Net::HTTPMovedPermanently.new nil, 301, nil
+      res
+    end
+
+    e = assert_raises Gem::RemoteFetcher::FetchError do
+      fetcher.fetch_http URI.parse(url)
+    end
+
+    assert_equal "redirecting but no redirect location was given (#{url})", e.message
+  end
+
   def test_fetch_http_with_additional_headers
     ENV["http_proxy"] = @proxy_uri
     ENV["no_proxy"] = URI::parse(@server_uri).host
@@ -1036,4 +1053,3 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_remote_fetcher.rb#L1053
   end
 
 end
-
Index: test/rubygems/test_gem.rb
===================================================================
--- test/rubygems/test_gem.rb	(revision 56276)
+++ test/rubygems/test_gem.rb	(revision 56277)
@@ -157,6 +157,35 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L157
     assert_match 'a-2/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
   end
 
+  def test_activate_bin_path_resolves_eagerly
+    a1 = util_spec 'a', '1' do |s|
+      s.executables = ['exec']
+      s.add_dependency 'b'
+    end
+
+    b1 = util_spec 'b', '1' do |s|
+      s.add_dependency 'c', '2'
+    end
+
+    b2 = util_spec 'b', '2' do |s|
+      s.add_dependency 'c', '1'
+    end
+
+    c1 = util_spec 'c', '1'
+    c2 = util_spec 'c', '2'
+
+    install_specs c1, c2, b1, b2, a1
+
+    Gem.activate_bin_path("a", "exec", ">= 0")
+
+    # If we didn't eagerly resolve, this would activate c-2 and then the
+    # finish_resolve would cause a conflict
+    gem 'c'
+    Gem.finish_resolve
+
+    assert_equal %w(a-1 b-2 c-1), loaded_spec_names
+  end
+
   def test_self_bin_path_no_exec_name
     e = assert_raises ArgumentError do
       Gem.bin_path 'a'
@@ -345,7 +374,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L374
     begin
       Dir.chdir 'detect/a/b'
 
-      assert_empty Gem.detect_gemdeps
+      assert_equal [BUNDLER_FULL_NAME], Gem.detect_gemdeps.map(&:full_name)
     ensure
       Dir.chdir @tempdir
     end
@@ -961,6 +990,9 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L990
 
   def test_self_sources
     assert_equal %w[http://gems.example.com/], Gem.sources
+    Gem.sources = nil
+    Gem.configuration.sources = %w[http://test.example.com/]
+    assert_equal %w[http://test.example.com/], Gem.sources
   end
 
   def test_try_activate_returns_true_for_activated_specs
@@ -1394,7 +1426,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1426
 
     Gem.detect_gemdeps
 
-    assert_equal %w!a-1 b-1 c-1!, loaded_spec_names
+    assert_equal %W(a-1 b-1 #{BUNDLER_FULL_NAME} c-1), loaded_spec_names
   end
 
   def test_auto_activation_of_detected_gemdeps_file
@@ -1417,10 +1449,40 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1449
 
     ENV['RUBYGEMS_GEMDEPS'] = "-"
 
-    assert_equal [a,b,c], Gem.detect_gemdeps.sort_by { |s| s.name }
+    assert_equal [a, b, util_spec("bundler", Bundler::VERSION), c], Gem.detect_gemdeps.sort_by { |s| s.name }
   end
 
   LIB_PATH = File.expand_path "../../../lib".dup.untaint, __FILE__.dup.untaint
+  BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.untaint
+  BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}"
+
+  def test_use_gemdeps_uses_bundler_postit_trampoline
+    refute_includes $LOADED_FEATURES, File.join(BUNDLER_LIB_PATH, "bundler/postit_trampoline.rb".dup.untaint)
+    ENV.delete("BUNDLE_DISABLE_POSTIT")
+
+    a = new_spec "a", "1", nil, "lib/a.rb"
+    b = new_spec "b", "1", nil, "lib/b.rb"
+    c = new_spec "c", "1", nil, "lib/c.rb"
+
+    install_specs a, b, c
+
+    path = File.join @tempdir, "gem.deps.rb"
+
+    File.open path, "w" do |f|
+      f.puts "gem 'a'"
+      f.puts "gem 'b'"
+      f.puts "gem 'c'"
+    end
+
+    ENV['RUBYGEMS_GEMDEPS'] = path
+
+    Gem.detect_gemdeps
+
+    assert_equal %W(a-1 b-1 #{BUNDLER_FULL_NAME} c-1), loaded_spec_names
+
+    trampoline_path = RUBY_VERSION > "1.9" ? File.join(BUNDLER_LIB_PATH, "bundler/postit_trampoline.rb".dup.untaint) : "bundler/postit_trampoline.rb"
+    assert_includes $LOADED_FEATURES, trampoline_path
+  end
 
   def test_looks_for_gemdeps_files_automatically_on_start
     util_clear_gems
@@ -1447,9 +1509,9 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1509
     ENV['GEM_PATH'] = path
     ENV['RUBYGEMS_GEMDEPS'] = "-"
 
-    out = `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
+    out = `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -I "#{BUNDLER_LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
 
-    assert_equal '["a-1", "b-1", "c-1"]', out.strip
+    assert_equal %W(a-1 b-1 #{BUNDLER_FULL_NAME} c-1).inspect, out.strip
   end
 
   def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
@@ -1479,12 +1541,12 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1541
 
     Dir.mkdir "sub1"
     out = Dir.chdir "sub1" do
-      `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
+      `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -I "#{BUNDLER_LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
     end
 
     Dir.rmdir "sub1"
 
-    assert_equal '["a-1", "b-1", "c-1"]', out.strip
+    assert_equal %W(a-1 b-1 #{BUNDLER_FULL_NAME} c-1).inspect, out.strip
   end
 
   def test_register_default_spec
@@ -1558,7 +1620,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1620
 
     Gem.use_gemdeps gem_deps_file
 
-    assert spec.activated?
+    assert_equal %W(a-1 #{BUNDLER_FULL_NAME}), loaded_spec_names
     refute_nil Gem.gemdeps
   end
 
@@ -1619,7 +1681,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1681
 
     Gem.use_gemdeps
 
-    assert spec.activated?
+    assert_equal %W(a-1 #{BUNDLER_FULL_NAME}), loaded_spec_names
   ensure
     ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
   end
@@ -1661,8 +1723,14 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1723
       io.write 'gem "a"'
     end
 
+    platform = Bundler::GemHelpers.generic_local_platform
+    if platform == Gem::Platform::RUBY
+      platform = ''
+    else
+      platform = " #{platform}"
+    end
     expected = <<-EXPECTED
-Unable to resolve dependency: user requested 'a (>= 0)'
+Could not find gem 'a#{platform}' in any of the gem sources listed in your Gemfile or available on this machine.
 You may need to `gem install -g` to install missing gems
 
     EXPECTED
@@ -1690,7 +1758,7 @@ You may need to `gem install -g` to inst https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1758
 
     Gem.use_gemdeps
 
-    assert spec.activated?
+    assert_equal %W(a-1 #{BUNDLER_FULL_NAME}), loaded_spec_names
   ensure
     ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
   end
Index: test/rubygems/test_gem_commands_query_command.rb
===================================================================
--- test/rubygems/test_gem_commands_query_command.rb	(revision 56276)
+++ test/rubygems/test_gem_commands_query_command.rb	(revision 56277)
@@ -557,6 +557,25 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_query_command.rb#L557
     assert_equal expected, @ui.output
   end
 
+  def test_execute_show_default_gems_with_platform
+    a1 = new_default_spec 'a', 1
+    a1.platform = 'java'
+    install_default_specs a1
+
+    use_ui @ui do
+      @cmd.execute
+    end
+
+    expected = <<-EOF
+
+*** LOCAL GEMS ***
+
+a (default: 1 java)
+EOF
+
+    assert_equal expected, @ui.output
+  end
+
   def test_execute_default_details
     spec_fetcher do |fetcher|
       fetcher.spec 'a', 2
Index: test/rubygems/test_gem_commands_setup_command.rb
===================================================================
--- test/rubygems/test_gem_commands_setup_command.rb	(revision 56276)
+++ test/rubygems/test_gem_commands_setup_command.rb	(revision 56277)
@@ -20,6 +20,13 @@ class TestGemCommandsSetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_setup_command.rb#L20
     open 'lib/rubygems.rb',           'w' do |io| io.puts '# rubygems.rb'  end
     open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
     open 'lib/rubygems/ssl_certs/rubygems.org/foo.pem', 'w' do |io| io.puts 'PEM'       end
+
+    FileUtils.mkdir_p 'bundler/exe'
+    FileUtils.mkdir_p 'bundler/lib/bundler'
+
+    open 'bundler/exe/bundle',        'w' do |io| io.puts '# bundle'       end
+    open 'bundler/lib/bundler.rb',    'w' do |io| io.puts '# bundler.rb'   end
+    open 'bundler/lib/bundler/b.rb',  'w' do |io| io.puts '# b.rb'         end
   end
 
   def test_pem_files_in
@@ -40,12 +47,16 @@ class TestGemCommandsSetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_setup_command.rb#L47
 
       assert_path_exists File.join(dir, 'rubygems.rb')
       assert_path_exists File.join(dir, 'rubygems/ssl_certs/rubygems.org/foo.pem')
+
+      assert_path_exists File.join(dir, 'bundler.rb')
+      assert_path_exists File.join(dir, 'bundler/b.rb')
     end
   end
 
   def test_remove_old_lib_files
     lib                   = File.join @install_dir, 'lib'
     lib_rubygems          = File.join lib, 'rubygems'
+    lib_bundler           = File.join lib, 'bundler'
     lib_rubygems_defaults = File.join lib_rubygems, 'defaults'
 
     securerandom_rb    = File.join lib, 'securerandom.rb'
@@ -55,13 +66,16 @@ class TestGemCommandsSetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_setup_command.rb#L66
 
     old_builder_rb     = File.join lib_rubygems, 'builder.rb'
     old_format_rb      = File.join lib_rubygems, 'format.rb'
+    old_bundler_c_rb   = File.join lib_bundler,  'c.rb'
 
     FileUtils.mkdir_p lib_rubygems_defaults
+    FileUtils.mkdir_p lib_bundler
 
     open securerandom_rb,    'w' do |io| io.puts '# securerandom.rb'     end
 
     open old_builder_rb,     'w' do |io| io.puts '# builder.rb'          end
     open old_format_rb,      'w' do |io| io.puts '# format.rb'           end
+    open old_bundler_c_rb,   'w' do |io| io.puts '# c.rb'                end
 
     open engine_defaults_rb, 'w' do |io| io.puts '# jruby.rb'            end
     open os_defaults_rb,     'w' do |io| io.puts '# operating_system.rb' end
@@ -70,6 +84,7 @@ class TestGemCommandsSetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_setup_command.rb#L84
 
     refute_path_exists old_builder_rb
     refute_path_exists old_format_rb
+    refute_path_exists old_bundler_c_rb
 
     assert_path_exists securerandom_rb
     assert_path_exists engine_defaults_rb
Index: test/rubygems/test_gem_version.rb
===================================================================
--- test/rubygems/test_gem_version.rb	(revision 56276)
+++ test/rubygems/test_gem_version.rb	(revision 56277)
@@ -65,7 +65,8 @@ class TestGemVersion < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_version.rb#L65
   def test_hash
     assert_equal v("1.2").hash, v("1.2").hash
     refute_equal v("1.2").hash, v("1.3").hash
-    refute_equal v("1.2").hash, v("1.2.0").hash
+    assert_equal v("1.2").hash, v("1.2.0").hash
+    assert_equal v("1.2.pre.1").hash, v("1.2.0.pre.1.0").hash
   end
 
   def test_initialize
@@ -99,6 +100,9 @@ class TestGemVersion < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_version.rb#L100
 
     assert_prerelease '1.A'
 
+    assert_prerelease '1-1'
+    assert_prerelease '1-a'
+
     refute_prerelease "1.2.0"
     refute_prerelease "2.9"
     refute_prerelease "22.1.50.0"
@@ -154,6 +158,12 @@ class TestGemVersion < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_version.rb#L158
     assert_equal         [9,8,7], v("9.8.7").segments
   end
 
+  def test_canonical_segments
+    assert_equal [1], v("1.0.0").canonical_segments
+    assert_equal [1, "a", 1], v("1.0.0.a.1.0").canonical_segments
+    assert_equal [1, 2, 3, "pre", 1], v("1.2.3-1").canonical_segments
+  end
+
   # Asserts that +version+ is a prerelease.
 
   def assert_prerelease version
@@ -183,6 +193,7 @@ class TestGemVersion < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_version.rb#L193
 
   def assert_version_equal expected, actual
     assert_equal v(expected), v(actual)
+    assert_equal v(expected).hash, v(actual).hash, "since #{actual} == #{expected}, they must have the same hash"
   end
 
   # Assert that two versions are eql?. Checks both directions.
Index: test/rubygems/test_gem_source.rb
===================================================================
--- test/rubygems/test_gem_source.rb	(revision 56276)
+++ test/rubygems/test_gem_source.rb	(revision 56277)
@@ -228,6 +228,15 @@ class TestGemSource < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_source.rb#L228
     assert_equal(-1, remote.   <=>(no_uri),    'remote <=> no_uri')
   end
 
+  def test_spaceship_order_is_preserved_when_uri_differs
+    sourceA = Gem::Source.new "http://example.com/a"
+    sourceB = Gem::Source.new "http://example.com/b"
+
+    assert_equal( 0, sourceA. <=>(sourceA), 'sourceA <=> sourceA')
+    assert_equal( 1, sourceA. <=>(sourceB), 'sourceA <=> sourceB')
+    assert_equal( 1, sourceB. <=>(sourceA), 'sourceB <=> sourceA')
+  end
+
   def test_update_cache_eh
     assert @source.update_cache?
   end
Index: test/rubygems/test_gem_config_file.rb
===================================================================
--- test/rubygems/test_gem_config_file.rb	(revision 56276)
+++ test/rubygems/test_gem_config_file.rb	(revision 56277)
@@ -61,12 +61,11 @@ class TestGemConfigFile < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_config_file.rb#L61
     end
 
     util_config_file
-
     assert_equal true, @cfg.backtrace
     assert_equal 10, @cfg.bulk_threshold
     assert_equal false, @cfg.verbose
     assert_equal false, @cfg.update_sources
-    assert_equal %w[http://more-gems.example.com], Gem.sources
+    assert_equal %w[http://more-gems.example.com], @cfg.sources
     assert_equal '--wrappers', @cfg[:install]
     assert_equal(['/usr/ruby/1.8/lib/ruby/gems/1.8', '/var/ruby/1.8/gem_home'],
                  @cfg.path)
Index: test/rubygems/test_gem_installer.rb
===================================================================
--- test/rubygems/test_gem_installer.rb	(revision 56276)
+++ test/rubygems/test_gem_installer.rb	(revision 56277)
@@ -1141,6 +1141,35 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L1141
     refute_path_exists should_be_removed
   end
 
+  def test_install_user_extension_dir
+    @spec.extensions << "extconf.rb"
+    write_file File.join(@tempdir, "extconf.rb") do |io|
+      io.write <<-RUBY
+        require "mkmf"
+        create_makefile("#{@spec.name}")
+      RUBY
+    end
+
+    @spec.files += %w[extconf.rb]
+
+    # Create the non-user ext dir
+    expected_extension_dir = @spec.extension_dir.dup
+    FileUtils.mkdir_p expected_extension_dir
+
+    use_ui @ui do
+      path = Gem::Package.build @spec
+
+      installer = Gem::Installer.at path, :user_install => true
+      installer.install
+    end
+
+    expected_makefile = File.join Gem.user_dir, 'gems', @spec.full_name, 'Makefile'
+
+    assert_path_exists expected_makefile
+    assert_path_exists expected_extension_dir
+    refute_path_exists File.join expected_extension_dir, 'gem_make.out'
+  end
+
   # ruby core repository needs to `depend` file for extension build.
   # but 1.9.2 and earlier mkmf.rb does not create TOUCH file like depend.
   if RUBY_VERSION < '1.9.3'
@@ -1387,7 +1416,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L1416
   def test_pre_install_checks_ruby_version
     use_ui @ui do
       installer = Gem::Installer.at old_ruby_required
-      e = assert_raises Gem::InstallError do
+      e = assert_raises Gem::RuntimeRequirementNotMetError do
         installer.pre_install_checks
       end
       assert_equal 'old_ruby_required requires Ruby version = 1.4.6.',
@@ -1406,7 +1435,7 @@ gem 'other', version https://github (... truncated)

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

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