Project

General

Profile

Backport #8682 ยป rubygems.2_0_6.ruby.2_0_0.patch

drbrain (Eric Hodel), 07/25/2013 07:06 AM

View differences:

lib/rubygems/commands/query_command.rb (working copy)
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|
......
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
lib/rubygems/commands/search_command.rb (working copy)
super 'search', 'Display all gems whose name contains STRING'
remove_option '--name-matches'
defaults[:domain] = :remote
end
def arguments # :nodoc:
lib/rubygems/ext/builder.rb (working copy)
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)
lib/rubygems/ext/ext_conf_builder.rb (working copy)
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
lib/rubygems/psych_additions.rb (working copy)
# in Specification._load, but if we don't have the constant, Marshal
# blows up.
module Psych # :nodoc:
module Psych
class PrivateType
end
end
lib/rubygems/remote_fetcher.rb (working copy)
require 'rubygems'
require 'rubygems/user_interaction'
require 'thread'
require 'uri'
require 'resolv'
......
Socket.do_not_reverse_lookup = true
@connections = {}
@connections_mutex = Mutex.new
@requests = Hash.new 0
@proxy_uri =
case proxy
......
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)
lib/rubygems/test_case.rb (working copy)
# 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
lib/rubygems.rb (working copy)
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
test/rubygems/test_gem_commands_query_command.rb (working copy)
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]
test/rubygems/test_gem_commands_search_command.rb (working copy)
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
test/rubygems/test_gem_ext_builder.rb (working copy)
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
test/rubygems/test_gem_ext_ext_conf_builder.rb (working copy)
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])
    (1-1/1)