summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-01-14 13:37:23 +0900
committerNARUSE, Yui <nurse@users.noreply.github.com>2021-01-14 16:44:42 +0900
commitc721e36ceca587d823a765cbbad90911a20cffce (patch)
tree96f70401c4ad1a22c688b6516111083d2d2a905c
parentd4f5827a6d445941450a2ec5dac5e51e333ef745 (diff)
Merge RubyGems-3.2.4
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/commands/setup_command.rb76
-rw-r--r--lib/rubygems/ext/builder.rb6
-rw-r--r--lib/rubygems/ext/cmake_builder.rb3
-rw-r--r--lib/rubygems/ext/configure_builder.rb3
-rw-r--r--lib/rubygems/remote_fetcher.rb4
-rw-r--r--lib/rubygems/resolver/best_set.rb2
-rw-r--r--lib/rubygems/resolver/index_specification.rb5
-rw-r--r--lib/rubygems/test_case.rb6
-rw-r--r--test/rubygems/data/null-required-rubygems-version.gemspec.rzbin0 -> 421 bytes
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb49
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb74
-rw-r--r--test/rubygems/test_gem_ext_builder.rb12
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb6
-rw-r--r--test/rubygems/test_gem_ext_configure_builder.rb4
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb2
-rw-r--r--test/rubygems/test_gem_resolver_best_set.rb23
-rw-r--r--test/rubygems/test_gem_specification.rb4
18 files changed, 108 insertions, 173 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index fe52d72cc3..0c3e5858d4 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -8,7 +8,7 @@
require 'rbconfig'
module Gem
- VERSION = "3.2.3".freeze
+ VERSION = "3.2.4".freeze
end
# Must be first since it unloads the prelude from 1.9.2
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 22b1371a1f..b5af43d7b7 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -6,8 +6,8 @@ require 'rubygems/command'
# RubyGems checkout or tarball.
class Gem::Commands::SetupCommand < Gem::Command
- HISTORY_HEADER = /^===\s*[\d.a-zA-Z]+\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze
- VERSION_MATCHER = /^===\s*([\d.a-zA-Z]+)\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze
+ HISTORY_HEADER = /^#\s*[\d.a-zA-Z]+\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze
+ VERSION_MATCHER = /^#\s*([\d.a-zA-Z]+)\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze
ENV_PATHS = %w[/usr/bin/env /bin/env].freeze
@@ -167,19 +167,18 @@ By default, this RubyGems will install gem as:
extend MakeDirs
lib_dir, bin_dir = make_destination_dirs install_destdir
- man_dir = make_man_dir install_destdir
+ man_dir = generate_default_man_dir install_destdir
install_lib lib_dir
- install_man man_dir
-
install_executables bin_dir
remove_old_bin_files bin_dir
remove_old_lib_files lib_dir
- remove_old_man_files man_dir
+ # Can be removed one we drop support for bundler 2.2.3 (the last version installing man files to man_dir)
+ remove_old_man_files man_dir if man_dir && File.exist?(man_dir)
install_default_bundler_gem bin_dir
@@ -330,21 +329,6 @@ By default, this RubyGems will install gem as:
end
end
- def install_man(man_dir)
- mans = { 'Bundler' => 'bundler/man' }
- mans.each do |tool, path|
- say "Installing #{tool} manpages" if @verbose
-
- bundler_man1_files = bundler_man1_files_in(path)
- bundler_man5_files = bundler_man5_files_in(path)
-
- Dir.chdir path do
- install_file_list(bundler_man1_files, "#{man_dir}/man1")
- install_file_list(bundler_man5_files, "#{man_dir}/man5")
- end
- end
- end
-
def install_rdoc
gem_doc_dir = File.join Gem.dir, 'doc'
rubygems_name = "rubygems-#{Gem::VERSION}"
@@ -392,7 +376,7 @@ By default, this RubyGems will install gem as:
mkdir_p specs_dir, :mode => 0755
bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
- bundler_spec.files = Dir.chdir("bundler") { Dir["{*.md,{lib,exe,man}/**/*}"] }
+ bundler_spec.files = Dir.chdir("bundler") { Dir["{*.md,{lib,exe}/**/*}"] }
bundler_spec.executables -= %w[bundler bundle_ruby]
# Remove bundler-*.gemspec in default specification directory.
@@ -455,19 +439,12 @@ By default, this RubyGems will install gem as:
return lib_dir, bin_dir
end
- def make_man_dir(install_destdir)
- man_dir = generate_default_man_dir(install_destdir)
-
- mkdir_p man_dir, :mode => 0755
-
- return man_dir
- end
-
def generate_default_man_dir(install_destdir)
prefix = options[:prefix]
if prefix.empty?
man_dir = RbConfig::CONFIG['mandir']
+ return unless man_dir
else
man_dir = File.join prefix, 'man'
end
@@ -518,20 +495,6 @@ By default, this RubyGems will install gem as:
end
end
- # for installation of bundler as default gems
- def bundler_man1_files_in(dir)
- Dir.chdir dir do
- Dir['bundle*.1']
- end
- end
-
- # for installation of bundler as default gems
- def bundler_man5_files_in(dir)
- Dir.chdir dir do
- Dir['gemfile.5']
- end
- end
-
def remove_old_bin_files(bin_dir)
old_bin_files = {
'gem_mirror' => 'gem mirror',
@@ -585,33 +548,26 @@ abort "#{deprecation_message}"
end
end
- def remove_old_man_files(man_dir)
- man_dirs = { man_dir => "bundler/man" }
- man_dirs.each do |old_man_dir, new_man_dir|
- man1_files = bundler_man1_files_in(new_man_dir)
-
- old_man1_dir = "#{old_man_dir}/man1"
- old_man1_files = bundler_man1_files_in(old_man1_dir)
- old_man1_files += Dir.chdir(old_man1_dir) { Dir["bundle*.1.{txt,ronn}"] }
+ def remove_old_man_files(old_man_dir)
+ old_man1_dir = "#{old_man_dir}/man1"
- man1_to_remove = old_man1_files - man1_files
+ if File.exist?(old_man1_dir)
+ man1_to_remove = Dir.chdir(old_man1_dir) { Dir["bundle*.1{,.txt,.ronn}"] }
remove_file_list(man1_to_remove, old_man1_dir)
+ end
- man5_files = bundler_man5_files_in(new_man_dir)
-
- old_man5_dir = "#{old_man_dir}/man5"
- old_man5_files = bundler_man5_files_in(old_man5_dir)
- old_man5_files += Dir.chdir(old_man5_dir) { Dir["gemfile.5.{txt,ronn}"] }
+ old_man5_dir = "#{old_man_dir}/man5"
- man5_to_remove = old_man5_files - man5_files
+ if File.exist?(old_man5_dir)
+ man5_to_remove = Dir.chdir(old_man5_dir) { Dir["gemfile.5{,.txt,.ronn}"] }
remove_file_list(man5_to_remove, old_man5_dir)
end
end
def show_release_notes
- release_notes = File.join Dir.pwd, 'History.txt'
+ release_notes = File.join Dir.pwd, 'CHANGELOG.md'
release_notes =
if File.exist? release_notes
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index f6de6a50d7..222fb9aa5e 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -29,7 +29,7 @@ class Gem::Ext::Builder
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
end
- destdir = '"DESTDIR=%s"' % ENV['DESTDIR']
+ destdir = 'DESTDIR=%s' % ENV['DESTDIR']
['clean', '', 'install'].each do |target|
# Pass DESTDIR via command line to override what's in MAKEFLAGS
@@ -37,7 +37,7 @@ class Gem::Ext::Builder
make_program,
destdir,
target,
- ].join(' ').rstrip
+ ].reject(&:empty?)
begin
run(cmd, results, "make #{target}".rstrip, make_dir)
rescue Gem::InstallError
@@ -56,7 +56,7 @@ class Gem::Ext::Builder
p(command)
end
results << "current directory: #{dir}"
- results << (command.respond_to?(:shelljoin) ? command.shelljoin : command)
+ results << command.shelljoin
require "open3"
# Set $SOURCE_DATE_EPOCH for the subprocess.
diff --git a/lib/rubygems/ext/cmake_builder.rb b/lib/rubygems/ext/cmake_builder.rb
index 2efec91f15..269e876cfa 100644
--- a/lib/rubygems/ext/cmake_builder.rb
+++ b/lib/rubygems/ext/cmake_builder.rb
@@ -4,8 +4,7 @@ require_relative '../command'
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, cmake_dir=Dir.pwd)
unless File.exist?(File.join(cmake_dir, 'Makefile'))
- cmd = "cmake . -DCMAKE_INSTALL_PREFIX=#{dest_path}"
- cmd << " #{Gem::Command.build_args.join ' '}" unless Gem::Command.build_args.empty?
+ cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args]
run cmd, results, class_name, cmake_dir
end
diff --git a/lib/rubygems/ext/configure_builder.rb b/lib/rubygems/ext/configure_builder.rb
index 36a758989b..eb2f9fce61 100644
--- a/lib/rubygems/ext/configure_builder.rb
+++ b/lib/rubygems/ext/configure_builder.rb
@@ -8,8 +8,7 @@
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd)
unless File.exist?(File.join(configure_dir, 'Makefile'))
- cmd = "sh ./configure --prefix=#{dest_path}"
- cmd << " #{args.join ' '}" unless args.empty?
+ cmd = ["sh", "./configure", "--prefix=#{dest_path}", *args]
run cmd, results, class_name, configure_dir
end
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index 285c80a95f..53e840978c 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -26,13 +26,15 @@ class Gem::RemoteFetcher
##
# The URI which was being accessed when the exception happened.
- attr_accessor :uri
+ attr_accessor :uri, :original_uri
def initialize(message, uri)
super message
uri = parse_uri(uri)
+ @original_uri = uri.dup
+
uri.password = 'REDACTED' if uri.respond_to?(:password) && uri.password
@uri = uri.to_s
diff --git a/lib/rubygems/resolver/best_set.rb b/lib/rubygems/resolver/best_set.rb
index b6a46a9403..300ea8015c 100644
--- a/lib/rubygems/resolver/best_set.rb
+++ b/lib/rubygems/resolver/best_set.rb
@@ -58,7 +58,7 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
# The calling method must retry the exception to repeat the lookup.
def replace_failed_api_set(error) # :nodoc:
- uri = error.uri
+ uri = error.original_uri
uri = URI uri unless URI === uri
uri = uri + "."
diff --git a/lib/rubygems/resolver/index_specification.rb b/lib/rubygems/resolver/index_specification.rb
index 45ff130a14..2aa6b419ba 100644
--- a/lib/rubygems/resolver/index_specification.rb
+++ b/lib/rubygems/resolver/index_specification.rb
@@ -43,9 +43,12 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification
##
# The required_rubygems_version constraint for this specification
#
+ # A fallback is included because the original version of the specification
+ # API didn't include that field, so some marshalled specs in the index have it
+ # set to +nil+.
def required_rubygems_version
- spec.required_rubygems_version
+ spec.required_rubygems_version || Gem::Requirement.default
end
def ==(other)
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index a8261ef5c2..6523c515be 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -250,16 +250,16 @@ class Gem::TestCase < Minitest::Test
def assert_contains_make_command(target, output, msg = nil)
if output.match(/\n/)
msg = message(msg) do
- 'Expected output containing make command "%s": %s' % [
+ "Expected output containing make command \"%s\", but was \n\nBEGIN_OF_OUTPUT\n%sEND_OF_OUTPUT" % [
('%s %s' % [make_command, target]).rstrip,
- output.inspect,
+ output,
]
end
else
msg = message(msg) do
'Expected make command "%s": %s' % [
('%s %s' % [make_command, target]).rstrip,
- output.inspect,
+ output,
]
end
end
diff --git a/test/rubygems/data/null-required-rubygems-version.gemspec.rz b/test/rubygems/data/null-required-rubygems-version.gemspec.rz
new file mode 100644
index 0000000000..db3d0af084
--- /dev/null
+++ b/test/rubygems/data/null-required-rubygems-version.gemspec.rz
Binary files differ
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index afdc5d0979..66a6707eb8 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -26,12 +26,12 @@ class TestGemCommandsSetupCommand < Gem::TestCase
bundler/exe/bundle
bundler/lib/bundler.rb
bundler/lib/bundler/b.rb
+ bundler/bin/bundler/man/bundle-b.1
bundler/lib/bundler/man/bundle-b.1.ronn
+ bundler/lib/bundler/man/gemfile.5
bundler/lib/bundler/man/gemfile.5.ronn
bundler/lib/bundler/templates/.circleci/config.yml
bundler/lib/bundler/templates/.travis.yml
- bundler/man/bundle-b.1
- bundler/man/gemfile.5
]
create_dummy_files(filelist)
@@ -160,16 +160,6 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.files_in('lib').sort
end
- def test_bundler_man1_files_in
- assert_equal %w[bundle-b.1],
- @cmd.bundler_man1_files_in('bundler/man').sort
- end
-
- def test_bundler_man5_files_in
- assert_equal %w[gemfile.5],
- @cmd.bundler_man5_files_in('bundler/man').sort
- end
-
def test_install_lib
@cmd.extend FileUtils
@@ -187,19 +177,6 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
end
- def test_install_man
- @cmd.extend FileUtils
-
- Dir.mktmpdir 'man' do |dir|
- @cmd.install_man dir
-
- assert_path_exists File.join("#{dir}/man1", 'bundle-b.1')
- refute_path_exists File.join("#{dir}/man1", 'bundle-b.1.ronn')
- assert_path_exists File.join("#{dir}/man5", 'gemfile.5')
- refute_path_exists File.join("#{dir}/man5", 'gemfile.5.ronn')
- end
- end
-
def test_install_default_bundler_gem
@cmd.extend FileUtils
@@ -308,8 +285,8 @@ class TestGemCommandsSetupCommand < Gem::TestCase
gemfile_5_ronn = File.join man, 'man5', 'gemfile.5.ronn'
gemfile_5_txt = File.join man, 'man5', 'gemfile.5.txt'
- files_that_go = [bundle_b_1_txt, bundle_b_1_ronn, gemfile_5_txt, gemfile_5_ronn]
- files_that_stay = [ruby_1, bundle_b_1, gemfile_5]
+ files_that_go = [bundle_b_1, bundle_b_1_txt, bundle_b_1_ronn, gemfile_5, gemfile_5_txt, gemfile_5_ronn]
+ files_that_stay = [ruby_1]
create_dummy_files(files_that_go + files_that_stay)
@@ -326,22 +303,22 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.options[:previous_version] = Gem::Version.new '2.0.2'
- File.open 'History.txt', 'w' do |io|
+ File.open 'CHANGELOG.md', 'w' do |io|
io.puts <<-HISTORY_TXT
-=== #{Gem::VERSION} / 2013-03-26
+# #{Gem::VERSION} / 2013-03-26
-* Bug fixes:
+## Bug fixes:
* Fixed release note display for LANG=C when installing rubygems
* π is tasty
-=== 2.0.2 / 2013-03-06
+# 2.0.2 / 2013-03-06
-* Bug fixes:
+## Bug fixes:
* Other bugs fixed
-=== 2.0.1 / 2013-03-05
+# 2.0.1 / 2013-03-05
-* Bug fixes:
+## Bug fixes:
* Yet more bugs fixed
HISTORY_TXT
end
@@ -351,9 +328,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
expected = <<-EXPECTED
-=== #{Gem::VERSION} / 2013-03-26
+# #{Gem::VERSION} / 2013-03-26
-* Bug fixes:
+## Bug fixes:
* Fixed release note display for LANG=C when installing rubygems
* π is tasty
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index fe8a74c750..85dba54675 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -946,6 +946,31 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[d-2], inst.installed_gems.map {|s| s.full_name }
end
+ def test_install_legacy_spec_with_nil_required_rubygems_version
+ path = File.expand_path "../data/null-required-rubygems-version.gemspec.rz", __FILE__
+ spec = Marshal.load Gem.read_binary(path)
+ def spec.validate(*args); end
+
+ util_build_gem spec
+
+ cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem"
+ FileUtils.mkdir_p File.dirname cache_file
+ FileUtils.mv spec.cache_file, cache_file
+
+ util_setup_spec_fetcher spec
+
+ data = Gem.read_binary(cache_file)
+
+ @fetcher.data['http://gems.example.com/gems/activesupport-1.0.0.gem'] = data
+
+ dep = Gem::Dependency.new 'activesupport'
+
+ inst = Gem::DependencyInstaller.new
+ inst.install dep
+
+ assert_equal %w[activesupport-1.0.0], Gem::Specification.map(&:full_name)
+ end
+
def test_find_gems_gems_with_sources
util_setup_gems
@@ -1102,21 +1127,6 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[a-1], requests
end
- def util_write_a1_bin
- write_file File.join('gems', 'a-1', 'bin', 'a_bin') do |fp|
- fp.puts "#!/usr/bin/ruby"
- end
- end
-
- def util_setup_c1_pre
- @c1_pre, @c1_pre_gem = util_spec 'c', '1.a' do |s|
- s.add_dependency 'a', '1.a'
- s.add_dependency 'b', '1'
- end
-
- util_reset_gems
- end
-
def util_setup_d
@d1, @d1_gem = util_gem 'd', '1'
@d2, @d2_gem = util_gem 'd', '2'
@@ -1124,43 +1134,13 @@ class TestGemDependencyInstaller < Gem::TestCase
util_reset_gems
end
- def util_setup_wxyz
- @x1_m, @x1_m_gem = util_spec 'x', '1' do |s|
- s.platform = Gem::Platform.new %w[cpu my_platform 1]
- end
-
- @x1_o, @x1_o_gem = util_spec 'x', '1' do |s|
- s.platform = Gem::Platform.new %w[cpu other_platform 1]
- end
-
- @w1, @w1_gem = util_spec 'w', '1', 'x' => nil
-
- @y1, @y1_gem = util_spec 'y', '1'
- @y1_1_p, @y1_1_p_gem = util_spec 'y', '1.1' do |s|
- s.platform = Gem::Platform.new %w[cpu my_platform 1]
- end
-
- @z1, @z1_gem = util_spec 'z', '1', 'y' => nil
-
- util_reset_gems
- end
-
def util_reset_gems
@a1 ||= nil
@b1 ||= nil
@a1_pre ||= nil
- @c1_pre ||= nil
@d1 ||= nil
@d2 ||= nil
- @w1 ||= nil
- @x1_m ||= nil
- @x1_o ||= nil
- @y1 ||= nil
- @y1_1_p ||= nil
- @z1 ||= nil
-
- util_setup_spec_fetcher(*[@a1, @a1_pre, @b1, @c1_pre,
- @d1, @d2, @x1_m, @x1_o, @w1, @y1,
- @y1_1_p, @z1].compact)
+
+ util_setup_spec_fetcher(*[@a1, @a1_pre, @b1, @d1, @d2].compact)
end
end
diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb
index 6e6bf89f9c..0fe650b8a5 100644
--- a/test/rubygems/test_gem_ext_builder.rb
+++ b/test/rubygems/test_gem_ext_builder.rb
@@ -47,9 +47,9 @@ install:
results = results.join("\n").b
- assert_match %r{"DESTDIR=#{ENV['DESTDIR']}" clean$}, results
- assert_match %r{"DESTDIR=#{ENV['DESTDIR']}"$}, results
- assert_match %r{"DESTDIR=#{ENV['DESTDIR']}" install$}, results
+ assert_match %r{DESTDIR\\=#{ENV['DESTDIR']} clean$}, results
+ assert_match %r{DESTDIR\\=#{ENV['DESTDIR']}$}, results
+ assert_match %r{DESTDIR\\=#{ENV['DESTDIR']} install$}, results
if /nmake/ !~ results
assert_match %r{^clean: destination$}, results
@@ -76,9 +76,9 @@ install:
results = results.join("\n").b
- assert_match %r{"DESTDIR=#{ENV['DESTDIR']}" clean$}, results
- assert_match %r{"DESTDIR=#{ENV['DESTDIR']}"$}, results
- assert_match %r{"DESTDIR=#{ENV['DESTDIR']}" install$}, results
+ assert_match %r{DESTDIR\\=#{ENV['DESTDIR']} clean$}, results
+ assert_match %r{DESTDIR\\=#{ENV['DESTDIR']}$}, results
+ assert_match %r{DESTDIR\\=#{ENV['DESTDIR']} install$}, results
end
def test_build_extensions
diff --git a/test/rubygems/test_gem_ext_cmake_builder.rb b/test/rubygems/test_gem_ext_cmake_builder.rb
index e347359679..dffe4a7fb3 100644
--- a/test/rubygems/test_gem_ext_cmake_builder.rb
+++ b/test/rubygems/test_gem_ext_cmake_builder.rb
@@ -40,8 +40,7 @@ install (FILES test.txt DESTINATION bin)
output = output.join "\n"
- assert_match \
- %r{^cmake \. -DCMAKE_INSTALL_PREFIX=#{Regexp.escape @dest_path}}, output
+ assert_match %r{^cmake \. -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}}, output
assert_match %r{#{Regexp.escape @ext}}, output
assert_contains_make_command '', output
assert_contains_make_command 'install', output
@@ -58,11 +57,10 @@ install (FILES test.txt DESTINATION bin)
output = output.join "\n"
shell_error_msg = %r{(CMake Error: .*)}
- sh_prefix_cmake = "cmake . -DCMAKE_INSTALL_PREFIX="
assert_match 'cmake failed', error.message
- assert_match %r{^#{sh_prefix_cmake}#{Regexp.escape @dest_path}}, output
+ assert_match %r{^cmake . -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}}, output
assert_match %r{#{shell_error_msg}}, output
end
diff --git a/test/rubygems/test_gem_ext_configure_builder.rb b/test/rubygems/test_gem_ext_configure_builder.rb
index a74f5ce055..6b11b0c2ab 100644
--- a/test/rubygems/test_gem_ext_configure_builder.rb
+++ b/test/rubygems/test_gem_ext_configure_builder.rb
@@ -28,7 +28,7 @@ class TestGemExtConfigureBuilder < Gem::TestCase
Gem::Ext::ConfigureBuilder.build nil, @dest_path, output, [], nil, @ext
assert_match(/^current directory:/, output.shift)
- assert_equal "sh ./configure --prefix=#{@dest_path}", output.shift
+ assert_equal "sh ./configure --prefix\\=#{@dest_path}", output.shift
assert_equal "", output.shift
assert_match(/^current directory:/, output.shift)
assert_contains_make_command 'clean', output.shift
@@ -50,7 +50,7 @@ class TestGemExtConfigureBuilder < Gem::TestCase
end
shell_error_msg = %r{(\./configure: .*)|((?:[Cc]an't|cannot) open '?\./configure'?(?:: No such file or directory)?)}
- sh_prefix_configure = "sh ./configure --prefix="
+ sh_prefix_configure = "sh ./configure --prefix\\="
assert_match 'configure failed', error.message
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 371998497b..1c88e8d3e8 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -205,7 +205,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@test_data
end
- raise Gem::RemoteFetcher::FetchError.new("haha!", nil)
+ raise Gem::RemoteFetcher::FetchError.new("haha!", '')
end
end
diff --git a/test/rubygems/test_gem_resolver_best_set.rb b/test/rubygems/test_gem_resolver_best_set.rb
index 657ad33387..019ca70499 100644
--- a/test/rubygems/test_gem_resolver_best_set.rb
+++ b/test/rubygems/test_gem_resolver_best_set.rb
@@ -132,4 +132,27 @@ class TestGemResolverBestSet < Gem::TestCase
assert_equal error, e
end
+
+ def test_replace_failed_api_set_uri_with_credentials
+ set = @DR::BestSet.new
+
+ api_uri = URI(@gem_repo) + './info/'
+ api_uri.user = 'user'
+ api_uri.password = 'pass'
+ api_set = Gem::Resolver::APISet.new api_uri
+
+ set.sets << api_set
+
+ error_uri = api_uri + 'a'
+
+ error = Gem::RemoteFetcher::FetchError.new 'bogus', error_uri
+
+ set.replace_failed_api_set error
+
+ assert_equal 1, set.sets.size
+
+ refute_includes set.sets, api_set
+
+ assert_kind_of Gem::Resolver::IndexSet, set.sets.first
+ end
end
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 76072184bd..374d58d38f 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1200,10 +1200,8 @@ dependencies: []
Gem.platforms = orig_platform
end
- DATA_PATH = File.expand_path "../data", __FILE__
-
def test_handles_private_null_type
- path = File.join DATA_PATH, "null-type.gemspec.rz"
+ path = File.expand_path "../data/null-type.gemspec.rz", __FILE__
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))