summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-07-21 10:21:39 +0900
committergit <svn-admin@ruby-lang.org>2023-07-25 06:23:28 +0000
commit8fbe7d0295fd38496b61e2e1a93c920f93892aa4 (patch)
tree9d7858b76edb337c11f2a710b706aac6dd07705f /lib
parent422144d220e8cfec38c0b07b2ba142aa5fa9066b (diff)
[rubygems/rubygems] Skip warnings if bundled gems is already loaded
https://github.com/rubygems/rubygems/commit/9583a7eb82
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/rubygems_integration.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 5f151e8c80..8f2b6994ed 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -233,13 +233,15 @@ module Bundler
kernel_class.send(:define_method, :require) do |file|
name = file.tr("/", "-")
if (::Gem::BUNDLED_GEMS.keys - specs.to_a.map(&:name)).include?(name)
- target_file = begin
- Bundler.default_gemfile.basename
- rescue GemfileNotFound
- "inline Gemfile"
- end
- warn "#{name} is not part of the default gems since Ruby #{::Gem::BUNDLED_GEMS[file]}." \
- " Add it to your #{target_file}."
+ unless $LOADED_FEATURES.any?{|f| f.end_with?("#{name}.rb", "#{name}.#{RbConfig::CONFIG['DLEXT']}")}
+ target_file = begin
+ Bundler.default_gemfile.basename
+ rescue GemfileNotFound
+ "inline Gemfile"
+ end
+ warn "#{name} is not part of the default gems since Ruby #{::Gem::BUNDLED_GEMS[file]}." \
+ " Add it to your #{target_file}."
+ end
end
kernel_class.send(:no_warning_require, file)
end