diff options
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/commands/query_command.rb | 17 | ||||
-rw-r--r-- | lib/rubygems/commands/search_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/ext/builder.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/ext/ext_conf_builder.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/psych_additions.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/remote_fetcher.rb | 9 | ||||
-rw-r--r-- | lib/rubygems/test_case.rb | 6 |
7 files changed, 32 insertions, 12 deletions
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb index 7bda7383e2..05b214bb63 100644 --- a/lib/rubygems/commands/query_command.rb +++ b/lib/rubygems/commands/query_command.rb @@ -14,7 +14,7 @@ class Gem::Commands::QueryCommand < Gem::Command 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::Command 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 diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb index 7810c85b36..c125715fe2 100644 --- a/lib/rubygems/commands/search_command.rb +++ b/lib/rubygems/commands/search_command.rb @@ -7,6 +7,8 @@ class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand super 'search', 'Display all gems whose name contains STRING' remove_option '--name-matches' + + defaults[:domain] = :remote end def arguments # :nodoc: diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index ab454b4ba1..79cae906ee 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -23,11 +23,13 @@ class Gem::Ext::Builder 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) diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb index 0032f4163c..5112eb8e2f 100644 --- a/lib/rubygems/ext/ext_conf_builder.rb +++ b/lib/rubygems/ext/ext_conf_builder.rb @@ -50,14 +50,14 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder 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 diff --git a/lib/rubygems/psych_additions.rb b/lib/rubygems/psych_additions.rb index dcc13fdf2e..08a5cb37ea 100644 --- a/lib/rubygems/psych_additions.rb +++ b/lib/rubygems/psych_additions.rb @@ -3,7 +3,7 @@ # in Specification._load, but if we don't have the constant, Marshal # blows up. -module Psych # :nodoc: +module Psych class PrivateType end end diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb index ec052b50da..86bad9de41 100644 --- a/lib/rubygems/remote_fetcher.rb +++ b/lib/rubygems/remote_fetcher.rb @@ -1,5 +1,6 @@ require 'rubygems' require 'rubygems/user_interaction' +require 'thread' require 'uri' require 'resolv' @@ -72,6 +73,7 @@ class Gem::RemoteFetcher 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 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) diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index e92e5d868a..7d087afade 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -1,5 +1,11 @@ # 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 |