From b33eac4858938c8122354c9d769e6ab2c451cc61 Mon Sep 17 00:00:00 2001 From: Hannah Ramadan Date: Wed, 21 Aug 2024 10:06:35 -0700 Subject: [PATCH] Why so complex --- lib/new_relic/agent/instrumentation/grape.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/new_relic/agent/instrumentation/grape.rb b/lib/new_relic/agent/instrumentation/grape.rb index 0e658e02c5..0c72352c8e 100644 --- a/lib/new_relic/agent/instrumentation/grape.rb +++ b/lib/new_relic/agent/instrumentation/grape.rb @@ -19,8 +19,10 @@ depends_on do begin - if defined?(Bundler) && ((Bundler::VERSION >= '2' && Bundler.rubygems.installed_specs.map(&:name).include?('newrelic-grape')) || - Bundler.rubygems.all_specs.map(&:name).include?('newrelic-grape')) + return unless defined?(Bundler) + + if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.0.0') && Bundler.rubygems.installed_specs.map(&:name).include?('newrelic-grape') || + Bundler.rubygems.all_specs.map(&:name).include?('newrelic-grape') NewRelic::Agent.logger.info('Not installing New Relic supported Grape instrumentation because the third party newrelic-grape gem is present') false else