Skip to content

Commit

Permalink
[rubygems/rubygems] rubocop -a
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Aug 29, 2023
1 parent 5e81127 commit f16c507
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/bundler/rubygems_integration.rb
Expand Up @@ -253,21 +253,21 @@ def replace_require(specs)
rescue GemfileNotFound
"inline Gemfile"
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]}." \
" Add #{name} to your #{target_file}."
location = caller_locations(1,1)[0]&.path
if File.file?(location) && !location.start_with?(Gem::BUNDLED_GEMS::LIBDIR)
caller_gem = nil
Gem.path.each do |path|
if location =~ /#{path}\/gems\/([\w\-\.]+)/
if location =~ %r{#{path}/gems/([\w\-\.]+)}
caller_gem = $1
break
end
end
message += " Also contact author of #{caller_gem} to add #{name} into its gemspec."
end
warn message, uplevel: 1
warn message, :uplevel => 1
end
end
kernel_class.send(:no_warning_require, file)
Expand Down

0 comments on commit f16c507

Please sign in to comment.