[rubygems/rubygems] rubocop -a

https://github.com/rubygems/rubygems/commit/f240bfad2a
This commit is contained in:
Hiroshi SHIBATA 2023-08-28 14:58:33 +09:00
parent 5e81127c1b
commit f16c50772c

View File

@ -253,21 +253,21 @@ module Bundler
rescue GemfileNotFound rescue GemfileNotFound
"inline Gemfile" "inline Gemfile"
end end
be = RUBY_VERSION < ::Gem::BUNDLED_GEMS::SINCE[name] ? "will be" : "is" be = ::Gem::BUNDLED_GEMS::SINCE[name] > RUBY_VERSION ? "will be" : "is"
message = "#{name} #{be} not part of the default gems since Ruby #{::Gem::BUNDLED_GEMS::SINCE[name]}." \ message = "#{name} #{be} not part of the default gems since Ruby #{::Gem::BUNDLED_GEMS::SINCE[name]}." \
" Add #{name} to your #{target_file}." " Add #{name} to your #{target_file}."
location = caller_locations(1,1)[0]&.path location = caller_locations(1,1)[0]&.path
if File.file?(location) && !location.start_with?(Gem::BUNDLED_GEMS::LIBDIR) if File.file?(location) && !location.start_with?(Gem::BUNDLED_GEMS::LIBDIR)
caller_gem = nil caller_gem = nil
Gem.path.each do |path| Gem.path.each do |path|
if location =~ /#{path}\/gems\/([\w\-\.]+)/ if location =~ %r{#{path}/gems/([\w\-\.]+)}
caller_gem = $1 caller_gem = $1
break break
end end
end end
message += " Also contact author of #{caller_gem} to add #{name} into its gemspec." message += " Also contact author of #{caller_gem} to add #{name} into its gemspec."
end end
warn message, uplevel: 1 warn message, :uplevel => 1
end end
end end
kernel_class.send(:no_warning_require, file) kernel_class.send(:no_warning_require, file)