From a530dfef2be3934decd975100585e3978ef49173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 7 Dec 2023 21:30:26 +0100 Subject: Improve bundled gem warnings Before, when requiring "bigdecimal" in a Bundler context: > foo.rb:1: warning: bigdecimal which will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. After: > foo.rb:1: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. --- lib/bundled_gems.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb index 66e13cfece..6b13adf91d 100644 --- a/lib/bundled_gems.rb +++ b/lib/bundled_gems.rb @@ -106,17 +106,18 @@ module Gem::BUNDLED_GEMS WARNED[name] = true if gem == true gem = name + "#{name} was loaded from the standard library, but" elsif gem return if WARNED[gem] WARNED[gem] = true - "#{name} is found in #{gem}" + "#{name} is found in #{gem}, which" else return end + build_message(gem) end def self.build_message(gem) - msg = " which #{RUBY_VERSION < SINCE[gem] ? "will no longer be" : "is not"} part of the default gems since Ruby #{SINCE[gem]}." + msg = " #{RUBY_VERSION < SINCE[gem] ? "will no longer be" : "is not"} part of the default gems since Ruby #{SINCE[gem]}." if defined?(Bundler) msg += " Add #{gem} to your Gemfile or gemspec." -- cgit v1.2.3