diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-11-11 10:41:39 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2021-11-22 10:51:35 +0900 |
commit | 24f911f474e11560af5fbd0f637f4c0ded23f604 (patch) | |
tree | 2f4d2fbdf6bc195012cbced0dac7d1463934cc67 | |
parent | 31a71048521224774bdb8b5982ab73eb35dad66d (diff) |
Merge RubyGems 3.2.28 and Bundler 2.2.28
-rw-r--r-- | lib/bundler/cli.rb | 1 | ||||
-rw-r--r-- | lib/bundler/cli/remove.rb | 3 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/newgem.gemspec.tt | 2 | ||||
-rw-r--r-- | lib/bundler/version.rb | 2 | ||||
-rw-r--r-- | lib/rubygems.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/platform.rb | 1 | ||||
-rw-r--r-- | lib/rubygems/resolver/set.rb | 1 | ||||
-rw-r--r-- | lib/rubygems/specification_policy.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/uri.rb | 9 | ||||
-rw-r--r-- | spec/bundler/commands/newgem_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/commands/remove_spec.rb | 3 | ||||
-rw-r--r-- | spec/bundler/other/major_deprecation_spec.rb | 19 | ||||
-rw-r--r-- | spec/bundler/support/builders.rb | 5 | ||||
-rw-r--r-- | test/rubygems/test_gem_platform.rb | 1 | ||||
-rw-r--r-- | test/rubygems/test_gem_request.rb | 12 | ||||
-rw-r--r-- | test/rubygems/test_gem_specification.rb | 14 | ||||
-rw-r--r-- | test/rubygems/test_gem_uri.rb | 7 | ||||
-rw-r--r-- | tool/bundler/rubocop_gems.rb.lock | 2 | ||||
-rw-r--r-- | tool/bundler/test_gems.rb.lock | 2 |
19 files changed, 73 insertions, 17 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 294b07d555..97c6f25a98 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -184,6 +184,7 @@ module Bundler method_option "install", :type => :boolean, :banner => "Runs 'bundle install' after removing the gems from the Gemfile" def remove(*gems) + SharedHelpers.major_deprecation(2, "The `--install` flag has been deprecated. `bundle install` is triggered by default.") if ARGV.include?("--install") require_relative "cli/remove" Remove.new(gems, options).run end diff --git a/lib/bundler/cli/remove.rb b/lib/bundler/cli/remove.rb index cd6a2cec28..44a4d891dd 100644 --- a/lib/bundler/cli/remove.rb +++ b/lib/bundler/cli/remove.rb @@ -11,8 +11,7 @@ module Bundler raise InvalidOption, "Please specify gems to remove." if @gems.empty? Injector.remove(@gems, {}) - - Installer.install(Bundler.root, Bundler.definition) if @options["install"] + Installer.install(Bundler.root, Bundler.definition) end end end diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt index 271d39dec5..d0086e4bd1 100644 --- a/lib/bundler/templates/newgem/newgem.gemspec.tt +++ b/lib/bundler/templates/newgem/newgem.gemspec.tt @@ -16,7 +16,7 @@ Gem::Specification.new do |spec| <%- end -%> spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>" - spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'" + spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 690d5a511c..cf4965c0db 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: false module Bundler - VERSION = "2.2.27".freeze + VERSION = "2.2.28".freeze def self.bundler_major_version @bundler_major_version ||= VERSION.split(".").first.to_i diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 4805debe6c..ebe9d7badd 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -8,7 +8,7 @@ require 'rbconfig' module Gem - VERSION = "3.2.27".freeze + VERSION = "3.2.28".freeze end # Must be first since it unloads the prelude from 1.9.2 diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb index 9750df181b..efb046c7aa 100644 --- a/lib/rubygems/platform.rb +++ b/lib/rubygems/platform.rb @@ -100,6 +100,7 @@ class Gem::Platform when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ] when /linux-?((?!gnu)\w+)?/ then [ 'linux', $1 ] when /mingw32/ then [ 'mingw32', nil ] + when /mingw-?(\w+)?/ then [ 'mingw', $1 ] when /(mswin\d+)(\_(\d+))?/ then os, version = $1, $3 @cpu = 'x86' if @cpu.nil? and os =~ /32$/ diff --git a/lib/rubygems/resolver/set.rb b/lib/rubygems/resolver/set.rb index 8046e18ea1..5d8dd51eaa 100644 --- a/lib/rubygems/resolver/set.rb +++ b/lib/rubygems/resolver/set.rb @@ -20,7 +20,6 @@ class Gem::Resolver::Set attr_accessor :prerelease def initialize # :nodoc: - require 'uri' @prerelease = false @remote = true @errors = [] diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb index 1f1f73b11f..c30ec707d9 100644 --- a/lib/rubygems/specification_policy.rb +++ b/lib/rubygems/specification_policy.rb @@ -381,7 +381,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li end LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '') - LAZY_PATTERN = /FI XME|TO DO/x.freeze + LAZY_PATTERN = /^FI XME|^TO DO/x.freeze HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i.freeze def validate_lazy_metadata diff --git a/lib/rubygems/uri.rb b/lib/rubygems/uri.rb index 031d7e01c3..ba30fac2f5 100644 --- a/lib/rubygems/uri.rb +++ b/lib/rubygems/uri.rb @@ -43,6 +43,11 @@ class Gem::Uri @parsed_uri.respond_to?(method_name, include_private) || super end + protected + + # Add a protected reader for the cloned instance to access the original object's parsed uri + attr_reader :parsed_uri + private ## @@ -99,4 +104,8 @@ class Gem::Uri def token? !user.nil? && password.nil? end + + def initialize_copy(original) + @parsed_uri = original.parsed_uri.clone + end end diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index 73ae721c69..a01d8b0aa8 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -450,7 +450,7 @@ RSpec.describe "bundle gem" do bundle "gem #{gem_name}" expect(generated_gemspec.metadata["allowed_push_host"]). - to match(/mygemserver\.com/) + to match(/example\.com/) end it "sets a minimum ruby version" do diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb index 170545f80c..9e2586bae6 100644 --- a/spec/bundler/commands/remove_spec.rb +++ b/spec/bundler/commands/remove_spec.rb @@ -13,7 +13,7 @@ RSpec.describe "bundle remove" do end end - context "when --install flag is specified" do + context "when --install flag is specified", :bundler => "< 3" do it "removes gems from .bundle" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -40,6 +40,7 @@ RSpec.describe "bundle remove" do bundle "remove rack" expect(out).to include("rack was removed.") + expect(the_bundle).to_not include_gems "rack" gemfile_should_be <<-G source "#{file_uri_for(gem_repo1)}" G diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index f97eefeef8..0262ef73c4 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -624,6 +624,25 @@ The :gist git source is deprecated, and will be removed in the future. Add this end end + context "bundle remove" do + before do + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" + G + end + + context "with --install" do + it "shows a deprecation warning", :bundler => "< 3" do + bundle "remove rack --install" + + expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default." + end + + pending "fails with a helpful message", :bundler => "3" + end + end + context "bundle console" do before do bundle "console", :raise_on_error => false diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb index 25377d2ac2..80e3d47b0b 100644 --- a/spec/bundler/support/builders.rb +++ b/spec/bundler/support/builders.rb @@ -35,6 +35,11 @@ module Spec build_repo gem_repo1 do FileUtils.cp rake_path, "#{gem_repo1}/gems/" + build_gem "coffee-script-source" + build_gem "git" + build_gem "puma" + build_gem "minitest" + build_gem "rack", %w[0.9.1 1.0.0] do |s| s.executables = "rackup" s.post_install_message = "Rack's post install message" diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb index aae0250801..8029035db1 100644 --- a/test/rubygems/test_gem_platform.rb +++ b/test/rubygems/test_gem_platform.rb @@ -122,6 +122,7 @@ class TestGemPlatform < Gem::TestCase 'i586-linux-gnu' => ['x86', 'linux', nil], 'i386-linux-gnu' => ['x86', 'linux', nil], 'i386-mingw32' => ['x86', 'mingw32', nil], + 'x64-mingw-ucrt' => ['x64', 'mingw', 'ucrt'], 'i386-mswin32' => ['x86', 'mswin32', nil], 'i386-mswin32_80' => ['x86', 'mswin32', '80'], 'i386-mswin32-80' => ['x86', 'mswin32', '80'], diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb index 0c370c8a04..66477be7bc 100644 --- a/test/rubygems/test_gem_request.rb +++ b/test/rubygems/test_gem_request.rb @@ -185,7 +185,7 @@ class TestGemRequest < Gem::TestCase end def test_fetch - uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}" + uri = Gem::Uri.new(URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}") response = util_stub_net_http(:body => :junk, :code => 200) do @request = make_request(uri, Net::HTTP::Get, nil, nil) @@ -198,7 +198,7 @@ class TestGemRequest < Gem::TestCase def test_fetch_basic_auth Gem.configuration.verbose = :really - uri = URI.parse "https://user:pass@example.rubygems/specs.#{Gem.marshal_version}" + uri = Gem::Uri.new(URI.parse "https://user:pass@example.rubygems/specs.#{Gem.marshal_version}") conn = util_stub_net_http(:body => :junk, :code => 200) do |c| use_ui @ui do @request = make_request(uri, Net::HTTP::Get, nil, nil) @@ -214,7 +214,7 @@ class TestGemRequest < Gem::TestCase def test_fetch_basic_auth_encoded Gem.configuration.verbose = :really - uri = URI.parse "https://user:%7BDEScede%7Dpass@example.rubygems/specs.#{Gem.marshal_version}" + uri = Gem::Uri.new(URI.parse "https://user:%7BDEScede%7Dpass@example.rubygems/specs.#{Gem.marshal_version}") conn = util_stub_net_http(:body => :junk, :code => 200) do |c| use_ui @ui do @@ -231,7 +231,7 @@ class TestGemRequest < Gem::TestCase def test_fetch_basic_oauth_encoded Gem.configuration.verbose = :really - uri = URI.parse "https://%7BDEScede%7Dpass:x-oauth-basic@example.rubygems/specs.#{Gem.marshal_version}" + uri = Gem::Uri.new(URI.parse "https://%7BDEScede%7Dpass:x-oauth-basic@example.rubygems/specs.#{Gem.marshal_version}") conn = util_stub_net_http(:body => :junk, :code => 200) do |c| use_ui @ui do @@ -247,7 +247,7 @@ class TestGemRequest < Gem::TestCase end def test_fetch_head - uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}" + uri = Gem::Uri.new(URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}") response = util_stub_net_http(:body => '', :code => 200) do |conn| @request = make_request(uri, Net::HTTP::Get, nil, nil) @request.fetch @@ -258,7 +258,7 @@ class TestGemRequest < Gem::TestCase end def test_fetch_unmodified - uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}" + uri = Gem::Uri.new(URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}") t = Time.utc(2013, 1, 2, 3, 4, 5) conn, response = util_stub_net_http(:body => '', :code => 304) do |c| @request = make_request(uri, Net::HTTP::Get, t, nil) diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 88afa3faa0..782ae0380f 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -2781,6 +2781,20 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use: end assert_equal %("#{f}" or "#{t}" is not a description), e.message + + # Adding #{f} anywhere after the start of the description should be fine. + @a1.description = "(some description) #{f}" + + assert_nothing_raised do + @a1.validate + end + + # Adding #{t} anywhere after the start of the description should be fine. + @a1.description = "(some description) #{t}" + + assert_nothing_raised do + @a1.validate + end end end diff --git a/test/rubygems/test_gem_uri.rb b/test/rubygems/test_gem_uri.rb index 0c70443f32..7fe572518b 100644 --- a/test/rubygems/test_gem_uri.rb +++ b/test/rubygems/test_gem_uri.rb @@ -29,4 +29,11 @@ class TestUri < Gem::TestCase def test_redacted_with_invalid_uri assert_equal "https://www.example.com:80index", Gem::Uri.new("https://www.example.com:80index").redacted.to_s end + + def test_redacted_does_not_modify_uri + url = 'https://user:password@example.com' + uri = Gem::Uri.new(url) + assert_equal 'https://user:REDACTED@example.com', uri.redacted.to_s + assert_equal url, uri.to_s + end end diff --git a/tool/bundler/rubocop_gems.rb.lock b/tool/bundler/rubocop_gems.rb.lock index 209d312609..6804d112e8 100644 --- a/tool/bundler/rubocop_gems.rb.lock +++ b/tool/bundler/rubocop_gems.rb.lock @@ -57,4 +57,4 @@ DEPENDENCIES test-unit BUNDLED WITH - 2.2.27 + 2.2.28 diff --git a/tool/bundler/test_gems.rb.lock b/tool/bundler/test_gems.rb.lock index 14b14c7226..d232e5bbd8 100644 --- a/tool/bundler/test_gems.rb.lock +++ b/tool/bundler/test_gems.rb.lock @@ -40,4 +40,4 @@ DEPENDENCIES webrick (= 1.7.0) BUNDLED WITH - 2.2.27 + 2.2.28 |