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

[Backport #8682]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2013-07-25 15:42:22 +00:00
parent 7567977adc
commit 589da706be
14 changed files with 148 additions and 17 deletions

View file

@ -1,3 +1,8 @@
Fri Jul 26 00:38:58 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
* lib/rubygems: Update to RubyGems 2.0.6. [ruby-core:56160]
[Backport #8682]
Wed Jul 24 22:35:32 2013 NARUSE, Yui <naruse@ruby-lang.org> Wed Jul 24 22:35:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
* lib/uri/generic.rb (find_proxy): raise BadURIError if the URI is * lib/uri/generic.rb (find_proxy): raise BadURIError if the URI is

View file

@ -8,7 +8,7 @@
require 'rbconfig' require 'rbconfig'
module Gem module Gem
VERSION = '2.0.5' VERSION = '2.0.6'
end end
# Must be first since it unloads the prelude from 1.9.2 # Must be first since it unloads the prelude from 1.9.2

View file

@ -14,7 +14,7 @@ class Gem::Commands::QueryCommand < Gem::Command
summary = 'Query gem information in local or remote repositories') summary = 'Query gem information in local or remote repositories')
super name, summary, super name, summary,
:name => //, :domain => :local, :details => false, :versions => true, :name => //, :domain => :local, :details => false, :versions => true,
:installed => false, :version => Gem::Requirement.default :installed => nil, :version => Gem::Requirement.default
add_option('-i', '--[no-]installed', add_option('-i', '--[no-]installed',
'Check for installed gem') do |value, options| 'Check for installed gem') do |value, options|
@ -67,16 +67,21 @@ class Gem::Commands::QueryCommand < Gem::Command
name = options[:name] name = options[:name]
prerelease = options[:prerelease] prerelease = options[:prerelease]
if options[:installed] then unless options[:installed].nil? then
if name.source.empty? then if name.source.empty? then
alert_error "You must specify a gem name" alert_error "You must specify a gem name"
exit_code |= 4 exit_code |= 4
elsif installed? name, options[:version] then else
installed = installed? name, options[:version]
installed = !installed unless options[:installed]
if installed then
say "true" say "true"
else else
say "false" say "false"
exit_code |= 1 exit_code |= 1
end end
end
terminate_interaction exit_code terminate_interaction exit_code
end end

View file

@ -7,6 +7,8 @@ class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
super 'search', 'Display all gems whose name contains STRING' super 'search', 'Display all gems whose name contains STRING'
remove_option '--name-matches' remove_option '--name-matches'
defaults[:domain] = :remote
end end
def arguments # :nodoc: def arguments # :nodoc:

View file

@ -23,11 +23,13 @@ class Gem::Ext::Builder
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make' make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
end end
destdir = '"DESTDIR=%s"' % ENV['DESTDIR'] if RUBY_VERSION > '2.0'
['', 'install'].each do |target| ['', 'install'].each do |target|
# Pass DESTDIR via command line to override what's in MAKEFLAGS # Pass DESTDIR via command line to override what's in MAKEFLAGS
cmd = [ cmd = [
make_program, make_program,
'"DESTDIR=%s"' % ENV['DESTDIR'], destdir,
target target
].join(' ').rstrip ].join(' ').rstrip
run(cmd, results, "make #{target}".rstrip) run(cmd, results, "make #{target}".rstrip)

View file

@ -50,14 +50,14 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
destent.exist? or File.rename(ent.path, destent.path) destent.exist? or File.rename(ent.path, destent.path)
end end
end end
results
ensure ensure
ENV["RUBYOPT"] = rubyopt ENV["RUBYOPT"] = rubyopt
ENV["DESTDIR"] = destdir ENV["DESTDIR"] = destdir
end end
end end
t.unlink if t and t.path t.unlink if t and t.path
results
ensure ensure
FileUtils.rm_rf tmp_dest if tmp_dest FileUtils.rm_rf tmp_dest if tmp_dest
end end

View file

@ -3,7 +3,7 @@
# in Specification._load, but if we don't have the constant, Marshal # in Specification._load, but if we don't have the constant, Marshal
# blows up. # blows up.
module Psych # :nodoc: module Psych
class PrivateType class PrivateType
end end
end end

View file

@ -1,5 +1,6 @@
require 'rubygems' require 'rubygems'
require 'rubygems/user_interaction' require 'rubygems/user_interaction'
require 'thread'
require 'uri' require 'uri'
require 'resolv' require 'resolv'
@ -72,6 +73,7 @@ class Gem::RemoteFetcher
Socket.do_not_reverse_lookup = true Socket.do_not_reverse_lookup = true
@connections = {} @connections = {}
@connections_mutex = Mutex.new
@requests = Hash.new 0 @requests = Hash.new 0
@proxy_uri = @proxy_uri =
case proxy case proxy
@ -391,8 +393,11 @@ class Gem::RemoteFetcher
end end
connection_id = [Thread.current.object_id, *net_http_args].join ':' connection_id = [Thread.current.object_id, *net_http_args].join ':'
connection = @connections_mutex.synchronize do
@connections[connection_id] ||= Net::HTTP.new(*net_http_args) @connections[connection_id] ||= Net::HTTP.new(*net_http_args)
connection = @connections[connection_id] @connections[connection_id]
end
if https?(uri) and not connection.started? then if https?(uri) and not connection.started? then
configure_connection_for_https(connection) configure_connection_for_https(connection)

View file

@ -1,5 +1,11 @@
# TODO: $SAFE = 1 # TODO: $SAFE = 1
begin
gem 'minitest', '~> 4.0'
rescue NoMethodError
# for ruby tests
end
if defined? Gem::QuickLoader if defined? Gem::QuickLoader
Gem::QuickLoader.load_full_rubygems_library Gem::QuickLoader.load_full_rubygems_library
else else

View file

@ -195,6 +195,34 @@ pl (1)
assert_equal '', @ui.error assert_equal '', @ui.error
end 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 def test_execute_installed_no_name
@cmd.handle_options %w[--installed] @cmd.handle_options %w[--installed]

View file

@ -0,0 +1,17 @@
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

View file

@ -0,0 +1,58 @@
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

View file

@ -27,7 +27,10 @@ class TestGemExtExtConfBuilder < Gem::TestCase
output = [] output = []
Dir.chdir @ext do Dir.chdir @ext do
result =
Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
assert_same result, output
end end
assert_match(/^#{Gem.ruby} extconf.rb/, output[0]) assert_match(/^#{Gem.ruby} extconf.rb/, output[0])

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.0.0" #define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2013-07-24" #define RUBY_RELEASE_DATE "2013-07-26"
#define RUBY_PATCHLEVEL 279 #define RUBY_PATCHLEVEL 280
#define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_YEAR 2013
#define RUBY_RELEASE_MONTH 7 #define RUBY_RELEASE_MONTH 7
#define RUBY_RELEASE_DAY 24 #define RUBY_RELEASE_DAY 26
#include "ruby/version.h" #include "ruby/version.h"