Skip to content

Commit

Permalink
Merge rubygems-3.2.0.rc.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Oct 15, 2020
1 parent f0c7a05 commit ab6c4f8
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 38 deletions.
2 changes: 1 addition & 1 deletion lib/rubygems.rb
Expand Up @@ -8,7 +8,7 @@
require 'rbconfig'

module Gem
VERSION = "3.2.0.rc.1".freeze
VERSION = "3.2.0.rc.2".freeze
end

# Must be first since it unloads the prelude from 1.9.2
Expand Down
19 changes: 9 additions & 10 deletions lib/rubygems/commands/setup_command.rb
Expand Up @@ -533,14 +533,14 @@ def rb_files_in(dir)
# for installation of bundler as default gems
def bundler_man1_files_in(dir)
Dir.chdir dir do
Dir['bundle*.1{,.txt}']
Dir['bundle*.1{,.txt,.ronn}']
end
end

# for installation of bundler as default gems
def bundler_man5_files_in(dir)
Dir.chdir dir do
Dir['gemfile.5{,.txt}']
Dir['gemfile.5{,.txt,.ronn}']
end
end

Expand Down Expand Up @@ -617,15 +617,16 @@ def remove_old_lib_files(lib_dir)
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)
["1", "5"].each do |section|
man_files = send(:"bundler_man#{section}_files_in", new_man_dir)

old_man1_dir = "#{old_man_dir}/man1"
old_man_dir_with_section = "#{old_man_dir}/man#{section}"
old_man_files = send(:"bundler_man#{section}_files_in", old_man_dir_with_section)

old_man1_files = bundler_man1_files_in(old_man1_dir)
man_to_remove = old_man_files - man_files

man1_to_remove = old_man1_files - man1_files

remove_file_list(man1_to_remove, old_man1_dir)
remove_file_list(man_to_remove, old_man_dir_with_section)
end
end
end

Expand All @@ -638,8 +639,6 @@ def show_release_notes

history.force_encoding Encoding::UTF_8

history = history.sub(/^# coding:.*?(?=^=)/m, '')

text = history.split(HISTORY_HEADER)
text.shift # correct an off-by-one generated by split
version_lines = history.scan(HISTORY_HEADER)
Expand Down
8 changes: 6 additions & 2 deletions lib/rubygems/requirement.rb
Expand Up @@ -270,7 +270,7 @@ def ==(other) # :nodoc:
return unless Gem::Requirement === other

# An == check is always necessary
return false unless requirements == other.requirements
return false unless _sorted_requirements == other._sorted_requirements

# An == check is sufficient unless any requirements use ~>
return true unless _tilde_requirements.any?
Expand All @@ -282,8 +282,12 @@ def ==(other) # :nodoc:

protected

def _sorted_requirements
@_sorted_requirements ||= requirements.sort_by(&:to_s)
end

def _tilde_requirements
requirements.select {|r| r.first == "~>" }
@_tilde_requirements ||= _sorted_requirements.select {|r| r.first == "~>" }
end

private
Expand Down
2 changes: 0 additions & 2 deletions lib/rubygems/test_case.rb
Expand Up @@ -109,8 +109,6 @@ class Gem::TestCase < Minitest::Test

TEST_PATH = ENV.fetch('RUBYGEMS_TEST_PATH', File.expand_path('../../../test/rubygems', __FILE__))

SPECIFICATIONS = File.expand_path(File.join(TEST_PATH, "specifications"), __FILE__)

def assert_activate(expected, *specs)
specs.each do |spec|
case spec
Expand Down
7 changes: 1 addition & 6 deletions test/rubygems/test_bundled_ca.rb
Expand Up @@ -15,15 +15,10 @@
#

class TestBundledCA < Gem::TestCase
THIS_FILE = File.expand_path __FILE__

def bundled_certificate_store
store = OpenSSL::X509::Store.new

ssl_cert_glob =
File.expand_path '../../../lib/rubygems/ssl_certs/*/*.pem', THIS_FILE

Dir[ssl_cert_glob].each do |ssl_cert|
Gem::Request.get_cert_files.each do |ssl_cert|
store.add_file ssl_cert
end

Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_gem_commands_build_command.rb
Expand Up @@ -148,7 +148,7 @@ def test_execute_strict_without_warnings
end

def test_execute_rubyforge_project_warning
rubyforge_gemspec = File.join SPECIFICATIONS, "rubyforge-0.0.1.gemspec"
rubyforge_gemspec = File.expand_path File.join("specifications", "rubyforge-0.0.1.gemspec"), __dir__

@cmd.options[:args] = [rubyforge_gemspec]

Expand Down
22 changes: 10 additions & 12 deletions test/rubygems/test_gem_commands_setup_command.rb
Expand Up @@ -29,9 +29,9 @@ def setup
bundler/lib/bundler/templates/.circleci/config.yml
bundler/lib/bundler/templates/.travis.yml
bundler/man/bundle-b.1
bundler/man/bundle-b.1.txt
bundler/man/bundle-b.1.ronn
bundler/man/gemfile.5
bundler/man/gemfile.5.txt
bundler/man/gemfile.5.ronn
]

create_dummy_files(filelist)
Expand Down Expand Up @@ -166,12 +166,12 @@ def test_rb_files_in
end

def test_bundler_man1_files_in
assert_equal %w[bundle-b.1 bundle-b.1.txt],
assert_equal %w[bundle-b.1 bundle-b.1.ronn],
@cmd.bundler_man1_files_in('bundler/man').sort
end

def test_bundler_man5_files_in
assert_equal %w[gemfile.5 gemfile.5.txt],
assert_equal %w[gemfile.5 gemfile.5.ronn],
@cmd.bundler_man5_files_in('bundler/man').sort
end

Expand Down Expand Up @@ -199,9 +199,9 @@ def test_install_man
@cmd.install_man dir

assert_path_exists File.join("#{dir}/man1", 'bundle-b.1')
assert_path_exists File.join("#{dir}/man1", 'bundle-b.1.txt')
assert_path_exists File.join("#{dir}/man1", 'bundle-b.1.ronn')
assert_path_exists File.join("#{dir}/man5", 'gemfile.5')
assert_path_exists File.join("#{dir}/man5", 'gemfile.5.txt')
assert_path_exists File.join("#{dir}/man5", 'gemfile.5.ronn')
end
end

Expand Down Expand Up @@ -307,14 +307,14 @@ def test_remove_old_man_files

ruby_1 = File.join man, 'man1', 'ruby.1'
bundle_b_1 = File.join man, 'man1', 'bundle-b.1'
bundle_b_1_ronn = File.join man, 'man1', 'bundle-b.1.ronn'
bundle_b_1_txt = File.join man, 'man1', 'bundle-b.1.txt'
bundle_old_b_1 = File.join man, 'man1', 'bundle-old_b.1'
bundle_old_b_1_txt = File.join man, 'man1', 'bundle-old_b.1.txt'
gemfile_5 = File.join man, 'man5', 'gemfile.5'
gemfile_5_ronn = File.join man, 'man5', 'gemfile.5.ronn'
gemfile_5_txt = File.join man, 'man5', 'gemfile.5.txt'

files_that_go = [bundle_old_b_1, bundle_old_b_1_txt]
files_that_stay = [ruby_1, bundle_b_1, bundle_b_1_txt, gemfile_5, gemfile_5_txt]
files_that_go = [bundle_b_1_txt, gemfile_5_txt]
files_that_stay = [ruby_1, bundle_b_1, bundle_b_1_ronn, gemfile_5, gemfile_5_ronn]

create_dummy_files(files_that_go + files_that_stay)

Expand All @@ -333,8 +333,6 @@ def test_show_release_notes

File.open 'History.txt', 'w' do |io|
io.puts <<-HISTORY_TXT
# coding: UTF-8
=== #{Gem::VERSION} / 2013-03-26
* Bug fixes:
Expand Down
2 changes: 2 additions & 0 deletions test/rubygems/test_gem_requirement.rb
Expand Up @@ -22,6 +22,8 @@ def test_equals2
refute_requirement_equal "~> 1.3", "~> 1.3.0"
refute_requirement_equal "~> 1.3.0", "~> 1.3"

assert_requirement_equal ["> 2", "~> 1.3", "~> 1.3.1"], ["~> 1.3.1", "~> 1.3", "> 2"]

assert_requirement_equal ["> 2", "~> 1.3"], ["> 2.0", "~> 1.3"]
assert_requirement_equal ["> 2.0", "~> 1.3"], ["> 2", "~> 1.3"]

Expand Down
8 changes: 4 additions & 4 deletions test/rubygems/test_gem_stub_specification.rb
Expand Up @@ -3,14 +3,14 @@
require "rubygems/stub_specification"

class TestStubSpecification < Gem::TestCase
FOO = File.join SPECIFICATIONS, "foo-0.0.1-x86-mswin32.gemspec"
BAR = File.join SPECIFICATIONS, "bar-0.0.2.gemspec"
FOO = File.expand_path File.join("specifications", "foo-0.0.1-x86-mswin32.gemspec"), __dir__
BAR = File.expand_path File.join("specifications", "bar-0.0.2.gemspec"), __dir__

def setup
super

@base_dir = File.dirname(SPECIFICATIONS)
@gems_dir = File.join File.dirname(SPECIFICATIONS), 'gem'
@base_dir = __dir__
@gems_dir = File.join __dir__, 'gem'
@foo = Gem::StubSpecification.gemspec_stub FOO, @base_dir, @gems_dir
end

Expand Down

0 comments on commit ab6c4f8

Please sign in to comment.