diff --git a/integration/apps/hanami/Gemfile b/integration/apps/hanami/Gemfile index 5305085d12a..bfc6fcdcf05 100644 --- a/integration/apps/hanami/Gemfile +++ b/integration/apps/hanami/Gemfile @@ -15,15 +15,7 @@ gem 'unicorn' gem 'webrick' gem 'pry-byebug' -gem_spec = Datadog::DemoEnv.gem_spec('datadog') -req = {require: 'datadog/auto_instrument'} -opts = if gem_spec.last.is_a?(Hash) - gem_spec.pop.merge(req) -else - req -end -gem_spec << opts -gem 'datadog', *gem_spec +gem Datadog::DemoEnv.gem_datadog_auto_instrument gem 'google-protobuf', '~> 3.0' group :development do diff --git a/integration/apps/rails-seven/Gemfile b/integration/apps/rails-seven/Gemfile index 85b7d128063..a5cfa1b3f59 100644 --- a/integration/apps/rails-seven/Gemfile +++ b/integration/apps/rails-seven/Gemfile @@ -7,7 +7,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem "rails", "~> 7.0.5" # Choose correct specs for 'datadog' demo environment -gem 'datadog', *Datadog::DemoEnv.gem_spec('datadog') +gem Datadog::DemoEnv.gem_datadog_auto_instrument gem 'dogstatsd-ruby' diff --git a/integration/images/include/datadog/demo_env.rb b/integration/images/include/datadog/demo_env.rb index 516f2a0d479..46190a078cd 100644 --- a/integration/images/include/datadog/demo_env.rb +++ b/integration/images/include/datadog/demo_env.rb @@ -3,7 +3,7 @@ module Datadog module DemoEnv module_function - def gem_spec(gem_name, defaults = {}) + def gem_spec(gem_name) args = if local_gem(gem_name) [local_gem(gem_name)] elsif git_gem(gem_name) @@ -17,6 +17,18 @@ def gem_spec(gem_name, defaults = {}) args end + def gem_datadog_auto_instrument + gem_spec = gem_spec('datadog') + req = {require: 'datadog/auto_instrument'} + opts = if gem_spec.last.is_a?(Hash) + gem_spec.pop.merge(req) + else + req + end + gem_spec << opts + ['datadog', *gem_spec] + end + def gem_env_name(gem_name) gem_name.upcase.tr('-', '_') end