ruby-changes:69845
From: Hiroshi <ko1@a...>
Date: Mon, 22 Nov 2021 10:51:57 +0900 (JST)
Subject: [ruby-changes:69845] 24f911f474 (ruby_3_0): Merge RubyGems 3.2.28 and Bundler 2.2.28
https://git.ruby-lang.org/ruby.git/commit/?id=24f911f474 From 24f911f474e11560af5fbd0f637f4c0ded23f604 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Thu, 11 Nov 2021 10:41:39 +0900 Subject: Merge RubyGems 3.2.28 and Bundler 2.2.28 --- lib/bundler/cli.rb | 1 + lib/bundler/cli/remove.rb | 3 +-- lib/bundler/templates/newgem/newgem.gemspec.tt | 2 +- lib/bundler/version.rb | 2 +- lib/rubygems.rb | 2 +- lib/rubygems/platform.rb | 1 + lib/rubygems/resolver/set.rb | 1 - lib/rubygems/specification_policy.rb | 2 +- lib/rubygems/uri.rb | 9 +++++++++ spec/bundler/commands/newgem_spec.rb | 2 +- spec/bundler/commands/remove_spec.rb | 3 ++- spec/bundler/other/major_deprecation_spec.rb | 19 +++++++++++++++++++ spec/bundler/support/builders.rb | 5 +++++ test/rubygems/test_gem_platform.rb | 1 + test/rubygems/test_gem_request.rb | 12 ++++++------ test/rubygems/test_gem_specification.rb | 14 ++++++++++++++ test/rubygems/test_gem_uri.rb | 7 +++++++ tool/bundler/rubocop_gems.rb.lock | 2 +- 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 294b07d5559..97c6f25a985 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -184,6 +184,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L184 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 cd6a2cec281..44a4d891ddd 100644 --- a/lib/bundler/cli/remove.rb +++ b/lib/bundler/cli/remove.rb @@ -11,8 +11,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/remove.rb#L11 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 271d39dec55..d0086e4bd1d 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| https://github.com/ruby/ruby/blob/trunk/lib/bundler/templates/newgem/newgem.gemspec.tt#L16 <%- 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 690d5a511c6..cf4965c0db5 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -1,7 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/version.rb#L1 # 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 4805debe6c0..ebe9d7baddb 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -8,7 +8,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L8 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 9750df181bc..efb046c7aa5 100644 --- a/lib/rubygems/platform.rb +++ b/lib/rubygems/platform.rb @@ -100,6 +100,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/lib/rubygems/platform.rb#L100 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 8046e18ea1a..5d8dd51eaa6 100644 --- a/lib/rubygems/resolver/set.rb +++ b/lib/rubygems/resolver/set.rb @@ -20,7 +20,6 @@ class Gem::Resolver::Set https://github.com/ruby/ruby/blob/trunk/lib/rubygems/resolver/set.rb#L20 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 1f1f73b11f8..c30ec707d98 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 https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification_policy.rb#L381 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 031d7e01c3f..ba30fac2f5b 100644 --- a/lib/rubygems/uri.rb +++ b/lib/rubygems/uri.rb @@ -43,6 +43,11 @@ class Gem::Uri https://github.com/ruby/ruby/blob/trunk/lib/rubygems/uri.rb#L43 @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 https://github.com/ruby/ruby/blob/trunk/lib/rubygems/uri.rb#L104 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 73ae721c697..a01d8b0aa8e 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -450,7 +450,7 @@ RSpec.describe "bundle gem" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/newgem_spec.rb#L450 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 170545f80cc..9e2586bae63 100644 --- a/spec/bundler/commands/remove_spec.rb +++ b/spec/bundler/commands/remove_spec.rb @@ -13,7 +13,7 @@ RSpec.describe "bundle remove" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/remove_spec.rb#L13 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 https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/remove_spec.rb#L40 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 f97eefeef89..0262ef73c4e 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 https://github.com/ruby/ruby/blob/trunk/spec/bundler/other/major_deprecation_spec.rb#L624 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 25377d2ac28..80e3d47b0bd 100644 --- a/spec/bundler/support/builders.rb +++ b/spec/bundler/support/builders.rb @@ -35,6 +35,11 @@ module Spec https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/builders.rb#L35 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_pl (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/