summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-28 00:57:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-28 00:57:53 +0000
commit69934aeb8d7948c4ca590b7092504c41d8bce6ac ()
tree7ea2cdc73f64c5fd001a4e626613ba435a425c0c
parentcc00f5bf36a2053e561d968a7e667ff31a9d72d7 (diff)
rubygems 2.6.7
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems to 2.6.7. Release note of 2.6.7: https://.com/rubygems/rubygems/commit/60f35bd1d2359fc30301d2d4cd72bc6833e8d12a git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/rubygems.rb53
-rw-r--r--lib/rubygems/commands/owner_command.rb4
-rw-r--r--lib/rubygems/commands/push_command.rb3
-rw-r--r--lib/rubygems/commands/query_command.rb27
-rw-r--r--lib/rubygems/commands/setup_command.rb159
-rw-r--r--lib/rubygems/commands/yank_command.rb3
-rw-r--r--lib/rubygems/config_file.rb6
-rwxr-xr-xlib/rubygems/core_ext/kernel_require.rb12
-rw-r--r--lib/rubygems/exceptions.rb6
-rw-r--r--lib/rubygems/installer.rb16
-rw-r--r--lib/rubygems/remote_fetcher.rb3
-rw-r--r--lib/rubygems/request_set.rb23
-rw-r--r--lib/rubygems/resolver.rb25
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb2
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb10
-rw-r--r--lib/rubygems/source.rb6
-rw-r--r--lib/rubygems/spec_fetcher.rb10
-rw-r--r--lib/rubygems/test_case.rb14
-rw-r--r--lib/rubygems/user_interaction.rb28
-rw-r--r--lib/rubygems/version.rb18
-rw-r--r--test/rubygems/test_gem.rb90
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb19
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb15
-rw-r--r--test/rubygems/test_gem_config_file.rb3
-rw-r--r--test/rubygems/test_gem_installer.rb33
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb18
-rw-r--r--test/rubygems/test_gem_resolver.rb26
-rw-r--r--test/rubygems/test_gem_source.rb9
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb20
-rw-r--r--test/rubygems/test_gem_version.rb13
31 files changed, 515 insertions, 165 deletions
@@ -1,3 +1,9 @@
Wed Sep 28 00:21:00 2016 Nobuyoshi Nakada <[email protected]>
* error.c (rb_warning_s_warn): the argument must be an
@@ -10,7 +10,7 @@ require 'rbconfig'
require 'thread'
module Gem
- VERSION = '2.6.6'
end
# Must be first since it unloads the prelude from 1.9.2
@@ -296,7 +296,10 @@ module Gem
def self.activate_bin_path name, exec_name, requirement # :nodoc:
spec = find_spec_for_exe name, exec_name, [requirement]
- Gem::LOADED_SPECS_MUTEX.synchronize { spec.activate }
spec.bin_file exec_name
end
@@ -593,7 +596,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Zlib::GzipReader wrapper that unzips +data+.
def self.gunzip(data)
- require 'rubygems/util'
Gem::Util.gunzip data
end
@@ -601,7 +603,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Zlib::GzipWriter wrapper that zips +data+.
def self.gzip(data)
- require 'rubygems/util'
Gem::Util.gzip data
end
@@ -609,7 +610,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# A Zlib::Inflate#inflate wrapper
def self.inflate(data)
- require 'rubygems/util'
Gem::Util.inflate data
end
@@ -971,7 +971,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# default_sources if the sources list is empty.
def self.sources
- @sources ||= Gem::SourceList.from(default_sources)
end
##
@@ -1146,8 +1147,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
path = path.dup
if path == "-" then
- require 'rubygems/util'
-
Gem::Util.traverse_parents Dir.pwd do |directory|
dep_file = GEM_DEP_FILES.find { |f| File.file?(f) }
@@ -1166,18 +1165,24 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
raise ArgumentError, "Unable to find gem dependencies file at #{path}"
end
- rs = Gem::RequestSet.new
- @gemdeps = rs.load_gemdeps path
-
- rs.resolve_current.map do |s|
- sp = s.full_spec
- sp.activate
- sp
end
- rescue Gem::LoadError, Gem::UnsatisfiableDependencyError => e
- warn e.message
- warn "You may need to `gem install -g` to install missing gems"
- warn ""
end
class << self
@@ -1223,6 +1228,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
prefix_pattern = /^(#{prefix_group})/
end
spec.files.each do |file|
if new_format
file = file.sub(prefix_pattern, "")
@@ -1230,6 +1237,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
end
@path_to_default_spec_map[file] = spec
end
end
@@ -1237,11 +1245,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Find a Gem::Specification of default gem from +path+
def find_unresolved_default_spec(path)
- Gem.suffixes.each do |suffix|
- spec = @path_to_default_spec_map["#{path}#{suffix}"]
- return spec if spec
- end
- nil
end
##
@@ -1327,6 +1331,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
autoload :SourceList, 'rubygems/source_list'
autoload :SpecFetcher, 'rubygems/spec_fetcher'
autoload :Specification, 'rubygems/specification'
autoload :Version, 'rubygems/version'
require "rubygems/specification"
@@ -40,7 +40,9 @@ permission to.
options[:remove] << value
end
- add_option '-h', '--host HOST', 'Use another gemcutter-compatible host' do |value, options|
options[:host] = value
end
end
@@ -33,7 +33,8 @@ command. For further discussion see the help for the yank command.
add_key_option
add_option('--host HOST',
- 'Push to another gemcutter-compatible host') do |value, options|
options[:host] = value
end
@@ -255,22 +255,21 @@ is too hard to use.
name_tuples.map { |n| n.version }.uniq
else
platforms.sort.reverse.map do |version, pls|
- if pls == [Gem::Platform::RUBY] then
- if options[:domain] == :remote || specs.all? { |spec| spec.is_a? Gem::Source }
- version
- else
- spec = specs.select { |s| s.version == version }
- if spec.first.default_gem?
- "default: #{version}"
- else
- version
- end
end
- else
- ruby = pls.delete Gem::Platform::RUBY
- platform_list = [ruby, *pls.sort].compact
- "#{version} #{platform_list.join ' '}"
end
end
end
@@ -142,6 +142,8 @@ By default, this RubyGems will install gem as:
remove_old_lib_files lib_dir
say "RubyGems #{Gem::VERSION} installed"
uninstall_old_gemcutter
@@ -202,59 +204,65 @@ By default, this RubyGems will install gem as:
end
end
- def install_executables(bin_dir)
- say "Installing gem executable" if @verbose
@bin_file_names = []
- Dir.chdir 'bin' do
- bin_files = Dir['*']
-
- bin_files.delete 'update_rubygems'
-
- bin_files.each do |bin_file|
- bin_file_formatted = if options[:format_executable] then
- Gem.default_exec_format % bin_file
- else
- bin_file
- end
- dest_file = File.join bin_dir, bin_file_formatted
- bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}"
- begin
- bin = File.readlines bin_file
- bin[0] = "#!#{Gem.ruby}\n"
- File.open bin_tmp_file, 'w' do |fp|
- fp.puts bin.join
- end
- install bin_tmp_file, dest_file, :mode => 0755
- @bin_file_names << dest_file
- ensure
- rm bin_tmp_file
- end
- next unless Gem.win_platform?
- begin
- bin_cmd_file = File.join Dir.tmpdir, "#{bin_file}.bat"
- File.open bin_cmd_file, 'w' do |file|
- file.puts <<-TEXT
-@ECHO OFF
-IF NOT "%~f0" == "~f0" GOTO :WinNT
-@"#{File.basename(Gem.ruby).chomp('"')}" "#{dest_file}" %1 %2 %3 %4 %5 %6 %7 %8 %9
-GOTO :EOF
-:WinNT
-@"#{File.basename(Gem.ruby).chomp('"')}" "%~dpn0" %*
-TEXT
end
- install bin_cmd_file, "#{dest_file}.bat", :mode => 0755
- ensure
- rm bin_cmd_file
end
end
end
@@ -269,18 +277,23 @@ TEXT
end
def install_lib(lib_dir)
- say "Installing RubyGems" if @verbose
-
- lib_files = rb_files_in 'lib'
- pem_files = pem_files_in 'lib'
-
- Dir.chdir 'lib' do
- lib_files.each do |lib_file|
- install_file lib_file, lib_dir
- end
- pem_files.each do |pem_file|
- install_file pem_file, lib_dir
end
end
end
@@ -326,6 +339,19 @@ TEXT
return false
end
def make_destination_dirs(install_destdir)
lib_dir, bin_dir = Gem.default_rubygems_dirs
@@ -416,23 +442,27 @@ abort "#{deprecation_message}"
end
def remove_old_lib_files lib_dir
- rubygems_dir = File.join lib_dir, 'rubygems'
- lib_files = rb_files_in 'lib/rubygems'
- old_lib_files = rb_files_in rubygems_dir
- to_remove = old_lib_files - lib_files
- to_remove.delete_if do |file|
- file.start_with? 'defaults'
- end
- Dir.chdir rubygems_dir do
- to_remove.each do |file|
- FileUtils.rm_f file
- warn "unable to remove old file #{file} please remove it by hand" if
- File.exist? file
end
end
end
@@ -481,4 +511,3 @@ abort "#{deprecation_message}"
end
end
-
@@ -42,7 +42,8 @@ as the reason for the removal request.
add_platform_option("remove")
add_option('--host HOST',
- 'Yank from another gemcutter-compatible host') do |value, options|
options[:host] = value
end
@@ -144,6 +144,10 @@ class Gem::ConfigFile
attr_accessor :ssl_ca_cert
##
# Path name of directory or file of openssl client certificate, used for remote https connection with client authentication
attr_reader :ssl_client_cert
@@ -216,6 +220,7 @@ class Gem::ConfigFile
@update_sources = @hash[:update_sources] if @hash.key? :update_sources
@verbose = @hash[:verbose] if @hash.key? :verbose
@disable_default_gem_server = @hash[:disable_default_gem_server] if @hash.key? :disable_default_gem_server
@ssl_verify_mode = @hash[:ssl_verify_mode] if @hash.key? :ssl_verify_mode
@ssl_ca_cert = @hash[:ssl_ca_cert] if @hash.key? :ssl_ca_cert
@@ -224,7 +229,6 @@ class Gem::ConfigFile
@api_keys = nil
@rubygems_api_key = nil
- Gem.sources = @hash[:sources] if @hash.key? :sources
handle_arguments arg_list
end
@@ -41,8 +41,7 @@ module Kernel
path = path.to_path if path.respond_to? :to_path
- spec = Gem.find_unresolved_default_spec(path)
- if spec
Gem.remove_unresolved_default_spec(spec)
gem(spec.name)
end
@@ -61,12 +60,10 @@ module Kernel
#--
# TODO request access to the C implementation of this to speed up RubyGems
- spec = Gem::Specification.find_active_stub_by_path path
-
- begin
RUBYGEMS_ACTIVATION_MONITOR.exit
return gem_original_require(path)
- end if spec
# Attempt to find +path+ in any unresolved gems...
@@ -104,7 +101,7 @@ module Kernel
# Ok, now find a gem that has no conflicts, starting
# at the highest version.
- valid = found_specs.reject { |s| s.has_conflicts? }.first
unless valid then
le = Gem::LoadError.new "unable to find a version of '#{names.first}' to activate"
@@ -138,4 +135,3 @@ module Kernel
private :require
end
-
@@ -154,6 +154,12 @@ class Gem::ImpossibleDependenciesError < Gem::Exception
end
class Gem::InstallError < Gem::Exception; end
##
# Potentially raised when a specification is validated.
@@ -282,18 +282,23 @@ class Gem::Installer
run_pre_install_hooks
# Completely remove any previous gem files
FileUtils.rm_rf gem_dir
FileUtils.rm_rf spec.extension_dir
FileUtils.mkdir_p gem_dir
- if @options[:install_as_default]
- spec.loaded_from = default_spec_file
extract_bin
write_default_spec
else
- spec.loaded_from = spec_file
extract_files
build_extensions
@@ -603,7 +608,8 @@ class Gem::Installer
def ensure_required_ruby_version_met # :nodoc:
if rrv = spec.required_ruby_version then
unless rrv.satisfied_by? Gem.ruby_version then
- raise Gem::InstallError, "#{spec.name} requires Ruby version #{rrv}."
end
end
end
@@ -611,7 +617,7 @@ class Gem::Installer
def ensure_required_rubygems_version_met # :nodoc:
if rrgv = spec.required_rubygems_version then
unless rrgv.satisfied_by? Gem.rubygems_version then
- raise Gem::InstallError,
"#{spec.name} requires RubyGems version #{rrgv}. " +
"Try 'gem update --system' to update RubyGems itself."
end
@@ -260,6 +260,9 @@ class Gem::RemoteFetcher
Net::HTTPTemporaryRedirect then
raise FetchError.new('too many redirects', uri) if depth > 10
location = URI.parse response['Location']
if https?(uri) && !https?(location)
@@ -163,9 +163,26 @@ class Gem::RequestSet
end
end
- spec = req.spec.install options do |installer|
- yield req, installer if block_given?
- end
requests << spec
end
@@ -233,8 +233,29 @@ class Gem::Resolver
exc.errors = @set.errors
raise exc
end
- possibles.sort_by { |s| [s.source, s.version, Gem::Platform.local =~ s.platform ? 1 : 0] }.
- map { |s| ActivationRequest.new s, dependency, [] }
end
def dependencies_for(specification)
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Gem::Resolver::Molinillo
# The version of Gem::Resolver::Molinillo.
- VERSION = '0.5.0'.freeze
end
@@ -184,6 +184,8 @@ module Gem::Resolver::Molinillo
raise VersionConflict.new(c) unless state
activated.rewind_to(sliced_states.first || :initial_state) if sliced_states
state.conflicts = c
end
end
@@ -209,7 +211,10 @@ module Gem::Resolver::Molinillo
# @return [Object] the requirement that led to `requirement` being added
# to the list of requirements.
def parent_of(requirement)
- @parent_of[requirement]
end
# @return [Object] the requirement that led to a version of a possibility
@@ -418,7 +423,8 @@ module Gem::Resolver::Molinillo
debug(depth) { "Requiring nested dependencies (#{nested_dependencies.join(', ')})" }
nested_dependencies.each do |d|
activated.add_child_vertex(name_for(d), nil, [name_for(activated_spec)], d)
- @parent_of[d] = requirement
end
push_state_for_requirements(requirements + nested_dependencies, !nested_dependencies.empty?)
@@ -67,7 +67,11 @@ class Gem::Source
return -1 if !other.uri
- @uri.to_s <=> other.uri.to_s
else
nil
end
@@ -184,10 +184,10 @@ class Gem::SpecFetcher
# Suggests gems based on the supplied +gem_name+. Returns an array of
# alternative gem names.
- def suggest_gems_from_name gem_name
gem_name = gem_name.downcase.tr('_-', '')
max = gem_name.size / 2
- names = available_specs(:latest).first.values.flatten(1)
matches = names.map { |n|
next unless n.match_platform?
@@ -201,7 +201,11 @@ class Gem::SpecFetcher
[n.name, distance]
}.compact
- matches = matches.uniq.sort_by { |name, dist| dist }
matches.first(5).map { |name, dist| name }
end
@@ -25,6 +25,7 @@ unless Gem::Dependency.new('rdoc', '>= 3.10').matching_specs.empty?
gem 'json'
end
require 'minitest/autorun'
require 'rubygems/deprecate'
@@ -222,17 +223,25 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@orig_gem_vendor = ENV['GEM_VENDOR']
@orig_gem_spec_cache = ENV['GEM_SPEC_CACHE']
@orig_rubygems_gemdeps = ENV['RUBYGEMS_GEMDEPS']
@orig_rubygems_host = ENV['RUBYGEMS_HOST']
ENV.keys.find_all { |k| k.start_with?('GEM_REQUIREMENT_') }.each do |k|
ENV.delete k
end
@orig_gem_env_requirements = ENV.to_hash
ENV['GEM_VENDOR'] = nil
@current_dir = Dir.pwd
@fetcher = nil
- @ui = Gem::MockGemUi.new
tmpdir = File.expand_path Dir.tmpdir
tmpdir.untaint
@@ -323,6 +332,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
Gem.loaded_specs.clear
Gem.clear_default_specs
Gem::Specification.unresolved_deps.clear
Gem.configuration.verbose = true
Gem.configuration.update_sources = true
@@ -394,7 +404,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase
ENV['GEM_VENDOR'] = @orig_gem_vendor
ENV['GEM_SPEC_CACHE'] = @orig_gem_spec_cache
ENV['RUBYGEMS_GEMDEPS'] = @orig_rubygems_gemdeps
ENV['RUBYGEMS_HOST'] = @orig_rubygems_host
Gem.ruby = @orig_ruby if @orig_ruby
@@ -7,11 +7,6 @@
require 'rubygems/util'
-begin
- require 'io/console'
-rescue LoadError
-end
-
##
# Module that defines the default UserInteraction. Any class including this
# module will have access to the +ui+ method that returns the default UI.
@@ -314,12 +309,21 @@ class Gem::StreamUI
password
end
- if IO.method_defined?(:noecho) then
- def _gets_noecho
- @ins.noecho {@ins.gets}
end
- elsif Gem.win_platform?
- def _gets_noecho
require "Win32API"
password = ''
@@ -332,9 +336,7 @@ class Gem::StreamUI
end
end
password
- end
- else
- def _gets_noecho
system "stty -echo"
begin
@ins.gets
@@ -237,7 +237,7 @@ class Gem::Version
end
def hash # :nodoc:
- @version.hash
end
def init_with coder # :nodoc:
@@ -331,7 +331,7 @@ class Gem::Version
def <=> other
return unless Gem::Version === other
- return 0 if @version == other._version
lhsegments = _segments
rhsegments = other._segments
@@ -356,6 +356,13 @@ class Gem::Version
return 0
end
protected
def _version
@@ -371,4 +378,11 @@ class Gem::Version
/^\d+$/ =~ s ? s.to_i : s
end.freeze
end
end
@@ -157,6 +157,35 @@ class TestGem < Gem::TestCase
assert_match 'a-2/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
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
begin
Dir.chdir 'detect/a/b'
- assert_empty Gem.detect_gemdeps
ensure
Dir.chdir @tempdir
end
@@ -961,6 +990,9 @@ class TestGem < Gem::TestCase
def test_self_sources
assert_equal %w[http://gems.example.com/], Gem.sources
end
def test_try_activate_returns_true_for_activated_specs
@@ -1394,7 +1426,7 @@ class TestGem < Gem::TestCase
Gem.detect_gemdeps
- assert_equal %w!a-1 b-1 c-1!, loaded_spec_names
end
def test_auto_activation_of_detected_gemdeps_file
@@ -1417,10 +1449,40 @@ class TestGem < Gem::TestCase
ENV['RUBYGEMS_GEMDEPS'] = "-"
- assert_equal [a,b,c], Gem.detect_gemdeps.sort_by { |s| s.name }
end
LIB_PATH = File.expand_path "../../../lib".dup.untaint, __FILE__.dup.untaint
def test_looks_for_gemdeps_files_automatically_on_start
util_clear_gems
@@ -1447,9 +1509,9 @@ class TestGem < Gem::TestCase
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"`
- assert_equal '["a-1", "b-1", "c-1"]', out.strip
end
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
@@ -1479,12 +1541,12 @@ class TestGem < Gem::TestCase
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"`
end
Dir.rmdir "sub1"
- assert_equal '["a-1", "b-1", "c-1"]', out.strip
end
def test_register_default_spec
@@ -1558,7 +1620,7 @@ class TestGem < Gem::TestCase
Gem.use_gemdeps gem_deps_file
- assert spec.activated?
refute_nil Gem.gemdeps
end
@@ -1619,7 +1681,7 @@ class TestGem < Gem::TestCase
Gem.use_gemdeps
- assert spec.activated?
ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
@@ -1661,8 +1723,14 @@ class TestGem < Gem::TestCase
io.write 'gem "a"'
end
expected = <<-EXPECTED
-Unable to resolve dependency: user requested 'a (>= 0)'
You may need to `gem install -g` to install missing gems
EXPECTED
@@ -1690,7 +1758,7 @@ You may need to `gem install -g` to install missing gems
Gem.use_gemdeps
- assert spec.activated?
ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
@@ -557,6 +557,25 @@ EOF
assert_equal expected, @ui.output
end
def test_execute_default_details
spec_fetcher do |fetcher|
fetcher.spec 'a', 2
@@ -20,6 +20,13 @@ class TestGemCommandsSetupCommand < Gem::TestCase
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
end
def test_pem_files_in
@@ -40,12 +47,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase
assert_path_exists File.join(dir, 'rubygems.rb')
assert_path_exists File.join(dir, 'rubygems/ssl_certs/rubygems.org/foo.pem')
end
end
def test_remove_old_lib_files
lib = File.join @install_dir, 'lib'
lib_rubygems = File.join lib, 'rubygems'
lib_rubygems_defaults = File.join lib_rubygems, 'defaults'
securerandom_rb = File.join lib, 'securerandom.rb'
@@ -55,13 +66,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase
old_builder_rb = File.join lib_rubygems, 'builder.rb'
old_format_rb = File.join lib_rubygems, 'format.rb'
FileUtils.mkdir_p lib_rubygems_defaults
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 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::TestCase
refute_path_exists old_builder_rb
refute_path_exists old_format_rb
assert_path_exists securerandom_rb
assert_path_exists engine_defaults_rb
@@ -61,12 +61,11 @@ class TestGemConfigFile < Gem::TestCase
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 '--wrappers', @cfg[:install]
assert_equal(['/usr/ruby/1.8/lib/ruby/gems/1.8', '/var/ruby/1.8/gem_home'],
@cfg.path)
@@ -1141,6 +1141,35 @@ gem 'other', version
refute_path_exists should_be_removed
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
def test_pre_install_checks_ruby_version
use_ui @ui do
installer = Gem::Installer.at old_ruby_required
- e = assert_raises Gem::InstallError do
installer.pre_install_checks
end
assert_equal 'old_ruby_required requires Ruby version = 1.4.6.',
@@ -1406,7 +1435,7 @@ gem 'other', version
use_ui @ui do
@installer = Gem::Installer.at gem
- e = assert_raises Gem::InstallError do
@installer.pre_install_checks
end
assert_equal 'old_rubygems_required requires RubyGems version < 0. ' +
@@ -687,6 +687,23 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
assert_equal "too many redirects (#{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==
end
end
-
@@ -683,6 +683,32 @@ class TestGemResolver < Gem::TestCase
assert_resolves_to [b1, c1, d2], r
end
def test_select_local_platforms
r = Gem::Resolver.new nil, nil
@@ -228,6 +228,15 @@ class TestGemSource < Gem::TestCase
assert_equal(-1, remote. <=>(no_uri), 'remote <=> no_uri')
end
def test_update_cache_eh
assert @source.update_cache?
end
@@ -169,6 +169,26 @@ class TestGemSpecFetcher < Gem::TestCase
assert_equal "bad news from the internet (#{@gem_repo})", sfp.error.message
end
def test_available_specs_latest
spec_fetcher do |fetcher|
fetcher.spec 'a', 1
@@ -65,7 +65,8 @@ class TestGemVersion < Gem::TestCase
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
end
def test_initialize
@@ -99,6 +100,9 @@ class TestGemVersion < Gem::TestCase
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
assert_equal [9,8,7], v("9.8.7").segments
end
# Asserts that +version+ is a prerelease.
def assert_prerelease version
@@ -183,6 +193,7 @@ class TestGemVersion < Gem::TestCase
def assert_version_equal expected, actual
assert_equal v(expected), v(actual)
end
# Assert that two versions are eql?. Checks both directions.