Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahramadan committed Aug 20, 2024
1 parent 8e732c9 commit d881fc4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
23 changes: 10 additions & 13 deletions lib/new_relic/agent/instrumentation/grape.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,16 @@

depends_on do
begin
if defined?(Bundler) &&
grape_present = if (Bundler::VERSION >= '2' && Bundler.rubygems.installed_specs.map(&:name).include?('newrelic-grape')) ||
Bundler.rubygems.all_specs.map(&:name).include?('newrelic-grape')
true
else
false
end
if grape_present
NewRelic::Agent.logger.info('Not installing New Relic supported Grape instrumentation because the third party newrelic-grape gem is present')
false
else
true
end
if defined?(Bundler)
grape_present = (Bundler::VERSION >= '2' && Bundler.rubygems.installed_specs.map(&:name).include?('newrelic-grape')) ||
Bundler.rubygems.all_specs.map(&:name).include?('newrelic-grape')

if grape_present
NewRelic::Agent.logger.info('Not installing New Relic supported Grape instrumentation because the third party newrelic-grape gem is present')
false
else
true
end
else
true
end
Expand Down
4 changes: 2 additions & 2 deletions lib/new_relic/environment_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def self.registered_reporters=(logic)
####################################
report_on('Gems') do
begin
specs_method = Bundler::VERSION >= '2' ? :installed_specs : :all_specs
Bundler.rubygems.send(specs_method).map { |gem| "#{gem.name} (#{gem.version})" }
specs_method = Bundler::VERSION >= '2' ? :installed_specs : :all_specs
Bundler.rubygems.send(specs_method).map { |gem| "#{gem.name} (#{gem.version})" }
rescue
# There are certain rubygem, bundler, rails combinations (e.g. gem
# 1.6.2, rails 2.3, bundler 1.2.3) where the code above throws an error
Expand Down

0 comments on commit d881fc4

Please sign in to comment.