Skip to content

Commit

Permalink
Merge pull request #1159 from jbockler/bundler-deprecation
Browse files Browse the repository at this point in the history
bundler deprecated the usage of `Bundler.rubygems.all_specs`
with version 2.5.12 (June 13, 2024), in order to better
support default gems.
This version is the new default version with ruby 3.3.3
and thus the warning pops up:

Bundler.rubygems.all_specs has been removed in favor
of Bundler.rubygems.installed_specs
  • Loading branch information
tombruijn authored Jul 5, 2024
2 parents 06f7ee6 + 9ff30cf commit 4d8299a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changesets/fix-deprecation-of-bundler-rubygems-all_specs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "patch"
type: "fix"
---

Fix deprecation warning of Bundler.rubygems.all_specs usage.
7 changes: 6 additions & 1 deletion lib/appsignal/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ def self.report(key)
def self.report_supported_gems
return unless defined?(Bundler) # Do nothing if Bundler is not present

bundle_gem_specs = ::Bundler.rubygems.all_specs
bundle_gem_specs =
if ::Bundler.rubygems.respond_to?(:installed_specs)
::Bundler.rubygems.installed_specs
else
::Bundler.rubygems.all_specs
end
SUPPORTED_GEMS.each do |gem_name|
gem_spec = bundle_gem_specs.find { |spec| spec.name == gem_name }
next unless gem_spec
Expand Down

0 comments on commit 4d8299a

Please sign in to comment.