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

ruby-changes:30118

From: nagachika <ko1@a...>
Date: Fri, 26 Jul 2013 00:42:38 +0900 (JST)
Subject: [ruby-changes:30118] nagachika:r42170 (ruby_2_0_0): * lib/rubygems: Update to RubyGems 2.0.6.

nagachika	2013-07-26 00:42:22 +0900 (Fri, 26 Jul 2013)

  New Revision: 42170

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

  Log:
    * lib/rubygems: Update to RubyGems 2.0.6. [ruby-core:56160]
      [Backport #8682]

  Added files:
    branches/ruby_2_0_0/test/rubygems/test_gem_ext_builder.rb
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/rubygems/commands/query_command.rb
    branches/ruby_2_0_0/lib/rubygems/commands/search_command.rb
    branches/ruby_2_0_0/lib/rubygems/ext/builder.rb
    branches/ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb
    branches/ruby_2_0_0/lib/rubygems/psych_additions.rb
    branches/ruby_2_0_0/lib/rubygems/remote_fetcher.rb
    branches/ruby_2_0_0/lib/rubygems/test_case.rb
    branches/ruby_2_0_0/lib/rubygems.rb
    branches/ruby_2_0_0/test/rubygems/test_gem_commands_query_command.rb
    branches/ruby_2_0_0/test/rubygems/test_gem_commands_search_command.rb
    branches/ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 42169)
+++ ruby_2_0_0/ChangeLog	(revision 42170)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Jul 26 00:38:58 2013  CHIKANAGA Tomoyuki  <nagachika@r...>
+
+	* lib/rubygems: Update to RubyGems 2.0.6. [ruby-core:56160]
+	  [Backport #8682]
+
 Wed Jul 24 22:35:32 2013  NARUSE, Yui  <naruse@r...>
 
 	* lib/uri/generic.rb (find_proxy): raise BadURIError if the URI is
Index: ruby_2_0_0/lib/rubygems/psych_additions.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/psych_additions.rb	(revision 42169)
+++ ruby_2_0_0/lib/rubygems/psych_additions.rb	(revision 42170)
@@ -3,7 +3,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/psych_additions.rb#L3
 # in Specification._load, but if we don't have the constant, Marshal
 # blows up.
 
-module Psych # :nodoc:
+module Psych
   class PrivateType
   end
 end
Index: ruby_2_0_0/lib/rubygems/ext/builder.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/ext/builder.rb	(revision 42169)
+++ ruby_2_0_0/lib/rubygems/ext/builder.rb	(revision 42170)
@@ -23,11 +23,13 @@ class Gem::Ext::Builder https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/ext/builder.rb#L23
       make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
     end
 
+    destdir = '"DESTDIR=%s"' % ENV['DESTDIR'] if RUBY_VERSION > '2.0'
+
     ['', 'install'].each do |target|
       # Pass DESTDIR via command line to override what's in MAKEFLAGS
       cmd = [
         make_program,
-        '"DESTDIR=%s"' % ENV['DESTDIR'],
+        destdir,
         target
       ].join(' ').rstrip
       run(cmd, results, "make #{target}".rstrip)
Index: ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb	(revision 42169)
+++ ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb	(revision 42170)
@@ -50,14 +50,14 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb#L50
             destent.exist? or File.rename(ent.path, destent.path)
           end
         end
-
-        results
       ensure
         ENV["RUBYOPT"] = rubyopt
         ENV["DESTDIR"] = destdir
       end
     end
     t.unlink if t and t.path
+
+    results
   ensure
     FileUtils.rm_rf tmp_dest if tmp_dest
   end
Index: ruby_2_0_0/lib/rubygems/remote_fetcher.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/remote_fetcher.rb	(revision 42169)
+++ ruby_2_0_0/lib/rubygems/remote_fetcher.rb	(revision 42170)
@@ -1,5 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/remote_fetcher.rb#L1
 require 'rubygems'
 require 'rubygems/user_interaction'
+require 'thread'
 require 'uri'
 require 'resolv'
 
@@ -72,6 +73,7 @@ class Gem::RemoteFetcher https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/remote_fetcher.rb#L73
     Socket.do_not_reverse_lookup = true
 
     @connections = {}
+    @connections_mutex = Mutex.new
     @requests = Hash.new 0
     @proxy_uri =
       case proxy
@@ -391,8 +393,11 @@ class Gem::RemoteFetcher https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/remote_fetcher.rb#L393
     end
 
     connection_id = [Thread.current.object_id, *net_http_args].join ':'
-    @connections[connection_id] ||= Net::HTTP.new(*net_http_args)
-    connection = @connections[connection_id]
+
+    connection = @connections_mutex.synchronize do
+      @connections[connection_id] ||= Net::HTTP.new(*net_http_args)
+      @connections[connection_id]
+    end
 
     if https?(uri) and not connection.started? then
       configure_connection_for_https(connection)
Index: ruby_2_0_0/lib/rubygems/commands/query_command.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/commands/query_command.rb	(revision 42169)
+++ ruby_2_0_0/lib/rubygems/commands/query_command.rb	(revision 42170)
@@ -14,7 +14,7 @@ class Gem::Commands::QueryCommand < Gem: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/query_command.rb#L14
                  summary = 'Query gem information in local or remote repositories')
     super name, summary,
          :name => //, :domain => :local, :details => false, :versions => true,
-         :installed => false, :version => Gem::Requirement.default
+         :installed => nil, :version => Gem::Requirement.default
 
     add_option('-i', '--[no-]installed',
                'Check for installed gem') do |value, options|
@@ -67,15 +67,20 @@ class Gem::Commands::QueryCommand < Gem: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/query_command.rb#L67
     name = options[:name]
     prerelease = options[:prerelease]
 
-    if options[:installed] then
+    unless options[:installed].nil? then
       if name.source.empty? then
         alert_error "You must specify a gem name"
         exit_code |= 4
-      elsif installed? name, options[:version] then
-        say "true"
       else
-        say "false"
-        exit_code |= 1
+        installed = installed? name, options[:version]
+        installed = !installed unless options[:installed]
+
+        if installed then
+          say "true"
+        else
+          say "false"
+          exit_code |= 1
+        end
       end
 
       terminate_interaction exit_code
Index: ruby_2_0_0/lib/rubygems/commands/search_command.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/commands/search_command.rb	(revision 42169)
+++ ruby_2_0_0/lib/rubygems/commands/search_command.rb	(revision 42170)
@@ -7,6 +7,8 @@ class Gem::Commands::SearchCommand < Gem https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/search_command.rb#L7
     super 'search', 'Display all gems whose name contains STRING'
 
     remove_option '--name-matches'
+
+    defaults[:domain] = :remote
   end
 
   def arguments # :nodoc:
Index: ruby_2_0_0/lib/rubygems/test_case.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/test_case.rb	(revision 42169)
+++ ruby_2_0_0/lib/rubygems/test_case.rb	(revision 42170)
@@ -1,5 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/test_case.rb#L1
 # TODO: $SAFE = 1
 
+begin
+  gem 'minitest', '~> 4.0'
+rescue NoMethodError
+  # for ruby tests
+end
+
 if defined? Gem::QuickLoader
   Gem::QuickLoader.load_full_rubygems_library
 else
Index: ruby_2_0_0/lib/rubygems.rb
===================================================================
--- ruby_2_0_0/lib/rubygems.rb	(revision 42169)
+++ ruby_2_0_0/lib/rubygems.rb	(revision 42170)
@@ -8,7 +8,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems.rb#L8
 require 'rbconfig'
 
 module Gem
-  VERSION = '2.0.5'
+  VERSION = '2.0.6'
 end
 
 # Must be first since it unloads the prelude from 1.9.2
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 42169)
+++ ruby_2_0_0/version.h	(revision 42170)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2013-07-24"
-#define RUBY_PATCHLEVEL 279
+#define RUBY_RELEASE_DATE "2013-07-26"
+#define RUBY_PATCHLEVEL 280
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 7
-#define RUBY_RELEASE_DAY 24
+#define RUBY_RELEASE_DAY 26
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/rubygems/test_gem_commands_search_command.rb
===================================================================
--- ruby_2_0_0/test/rubygems/test_gem_commands_search_command.rb	(revision 42169)
+++ ruby_2_0_0/test/rubygems/test_gem_commands_search_command.rb	(revision 42170)
@@ -0,0 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_commands_search_command.rb#L1
+require 'rubygems/test_case'
+require 'rubygems/commands/search_command'
+
+class TestGemCommandsSearchCommand < Gem::TestCase
+
+  def setup
+    super
+
+    @cmd = Gem::Commands::SearchCommand.new
+  end
+
+  def test_initialize
+    assert_equal :remote, @cmd.defaults[:domain]
+  end
+
+end
+
Index: ruby_2_0_0/test/rubygems/test_gem_commands_query_command.rb
===================================================================
--- ruby_2_0_0/test/rubygems/test_gem_commands_query_command.rb	(revision 42169)
+++ ruby_2_0_0/test/rubygems/test_gem_commands_query_command.rb	(revision 42170)
@@ -195,6 +195,34 @@ pl (1) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_commands_query_command.rb#L195
     assert_equal '', @ui.error
   end
 
+  def test_execute_installed_inverse
+    @cmd.handle_options %w[-n a --no-installed]
+
+    e = assert_raises Gem::MockGemUi::TermError do
+      use_ui @ui do
+        @cmd.execute
+      end
+    end
+
+    assert_equal "false\n", @ui.output
+    assert_equal '', @ui.error
+
+    assert_equal 1, e.exit_code
+  end
+
+  def test_execute_installed_inverse_not_installed
+    @cmd.handle_options %w[-n not_installed --no-installed]
+
+    assert_raises Gem::MockGemUi::SystemExitException do
+      use_ui @ui do
+        @cmd.execute
+      end
+    end
+
+    assert_equal "true\n", @ui.output
+    assert_equal '', @ui.error
+  end
+
   def test_execute_installed_no_name
     @cmd.handle_options %w[--installed]
 
Index: ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb
===================================================================
--- ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb	(revision 42169)
+++ ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb	(revision 42170)
@@ -27,7 +27,10 @@ class TestGemExtExtConfBuilder < Gem::Te https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb#L27
     output = []
 
     Dir.chdir @ext do
-      Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
+      result =
+        Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
+
+      assert_same result, output
     end
 
     assert_match(/^#{Gem.ruby} extconf.rb/, output[0])
Index: ruby_2_0_0/test/rubygems/test_gem_ext_builder.rb
===================================================================
--- ruby_2_0_0/test/rubygems/test_gem_ext_builder.rb	(revision 0)
+++ ruby_2_0_0/test/rubygems/test_gem_ext_builder.rb	(revision 42170)
@@ -0,0 +1,58 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_ext_builder.rb#L1
+require 'rubygems/test_case'
+require 'rubygems/ext'
+
+class TestGemExtBuilder < Gem::TestCase
+
+  def setup
+    super
+
+    @ext = File.join @tempdir, 'ext'
+    @dest_path = File.join @tempdir, 'prefix'
+
+    FileUtils.mkdir_p @ext
+    FileUtils.mkdir_p @dest_path
+
+    @orig_DESTDIR = ENV['DESTDIR']
+  end
+
+  def teardown
+    ENV['DESTDIR'] = @orig_DESTDIR
+
+    super
+  end
+
+  def test_class_make
+    ENV['DESTDIR'] = 'destination'
+    results = []
+
+    Dir.chdir @ext do
+      open 'Makefile', 'w' do |io|
+        io.puts <<-MAKEFILE
+all:
+\t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}"
+
+install:
+\t@#{Gem.ruby} -e "puts %Q{install: \#{ENV['DESTDIR']}}"
+        MAKEFILE
+      end
+
+      Gem::Ext::Builder.make @dest_path, results
+    end
+
+    results = results.join "\n"
+
+
+    if RUBY_VERSION > '2.0' then
+      assert_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%,         results
+      assert_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results
+    else
+      refute_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%,         results
+      refute_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results
+    end
+
+    assert_match %r%^all: destination$%,     results
+    assert_match %r%^install: destination$%, results
+  end
+
+end
+

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

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