summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-07-20 11:38:52 +0900
committergit <svn-admin@ruby-lang.org>2023-07-25 06:23:26 +0000
commitfc5dbea4c3aca71b97db22b47b934454705ceed8 (patch)
tree365172f958978fcc35f30d86e5bafda8dde42772
parentec600332fcf60a0d54cf5de1051d189270931ee3 (diff)
[rubygems/rubygems] Added Ruby version for bundled gems to warnings
https://github.com/rubygems/rubygems/commit/d61c1362e7
-rw-r--r--lib/bundler/rubygems_ext.rb17
-rw-r--r--lib/bundler/rubygems_integration.rb4
-rw-r--r--spec/bundler/runtime/setup_spec.rb2
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