From fc5dbea4c3aca71b97db22b47b934454705ceed8 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 20 Jul 2023 11:38:52 +0900 Subject: [rubygems/rubygems] Added Ruby version for bundled gems to warnings https://github.com/rubygems/rubygems/commit/d61c1362e7 --- lib/bundler/rubygems_ext.rb | 17 +++++++++++++---- lib/bundler/rubygems_integration.rb | 4 ++-- spec/bundler/runtime/setup_spec.rb | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index c21884ee13..a6a5c569ac 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -30,10 +30,19 @@ end module Gem - BUNDLED_GEMS = %w[ - abbrev observer getoptlong resolv-replace rinda - nkf syslog drb mutex_m csv base64 - ] + BUNDLED_GEMS = { + "abbrev" => "3.4.0", + "observer" => "3.4.0", + "getoptlong" => "3.4.0", + "resolv-replace" => "3.4.0", + "rinda" => "3.4.0", + "nkf" => "3.4.0", + "syslog" => "3.4.0", + "drb" => "3.4.0", + "mutex_m" => "3.4.0", + "csv" => "3.4.0", + "base64" => "3.4.0" + }.freeze class Specification include ::Bundler::MatchMetadata diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 9e222f90b1..011021adf8 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -233,13 +233,13 @@ module Bundler [kernel, ::Kernel].each do |kernel_class| kernel_class.send(:alias_method, :no_warning_require, :require) kernel_class.send(:define_method, :require) do |file| - if (::Gem::BUNDLED_GEMS - specs.to_a.map(&:name)).include?(file) + if (::Gem::BUNDLED_GEMS.keys - specs.to_a.map(&:name)).include?(file) target_file = begin Bundler.default_gemfile.basename rescue GemfileNotFound "inline Gemfile" end - warn "#{file} is not part of the bundle." \ + warn "#{file} is not part of the default gems since Ruby #{::Gem::BUNDLED_GEMS[file]}." \ " Add it to your #{target_file}." end kernel_class.send(:no_warning_require, file) diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index ed2a2e9974..f1ea79512f 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -1567,7 +1567,7 @@ end require 'csv' R - expect(err).to include("csv is not part of the bundle") + expect(err).to include("csv is not part of the default gems") end it "don't warn with bundled gems when it's declared in Gemfile" do -- cgit v1.2.3