appsignal 3.4.0 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +63 -21
  3. data/.rubocop_todo.yml +68 -54
  4. data/.semaphore/semaphore.yml +11 -11
  5. data/CHANGELOG.md +37 -0
  6. data/Rakefile +15 -99
  7. data/appsignal.gemspec +3 -4
  8. data/bin/appsignal +4 -2
  9. data/build_matrix.yml +4 -4
  10. data/ext/._appsignal-agent +0 -0
  11. data/ext/Rakefile +22 -21
  12. data/ext/agent.rb +2 -0
  13. data/ext/base.rb +14 -17
  14. data/ext/extconf.rb +4 -1
  15. data/lib/appsignal/auth_check.rb +3 -3
  16. data/lib/appsignal/capistrano.rb +1 -1
  17. data/lib/appsignal/cli/demo.rb +5 -2
  18. data/lib/appsignal/cli/diagnose/paths.rb +4 -1
  19. data/lib/appsignal/cli/diagnose/utils.rb +7 -3
  20. data/lib/appsignal/cli/diagnose.rb +7 -5
  21. data/lib/appsignal/cli/helpers.rb +1 -4
  22. data/lib/appsignal/cli/install.rb +4 -10
  23. data/lib/appsignal/cli.rb +3 -2
  24. data/lib/appsignal/config.rb +105 -102
  25. data/lib/appsignal/demo.rb +2 -1
  26. data/lib/appsignal/environment.rb +2 -0
  27. data/lib/appsignal/event_formatter/action_view/render_formatter.rb +2 -1
  28. data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +13 -13
  29. data/lib/appsignal/event_formatter.rb +5 -4
  30. data/lib/appsignal/extension/jruby.rb +11 -9
  31. data/lib/appsignal/extension.rb +1 -1
  32. data/lib/appsignal/helpers/instrumentation.rb +50 -35
  33. data/lib/appsignal/hooks/action_cable.rb +6 -4
  34. data/lib/appsignal/hooks/action_mailer.rb +2 -0
  35. data/lib/appsignal/hooks/active_job.rb +11 -10
  36. data/lib/appsignal/hooks/active_support_notifications.rb +3 -4
  37. data/lib/appsignal/hooks/data_mapper.rb +1 -1
  38. data/lib/appsignal/hooks/gvl.rb +3 -0
  39. data/lib/appsignal/hooks/http.rb +1 -1
  40. data/lib/appsignal/hooks/mri.rb +2 -0
  41. data/lib/appsignal/hooks/net_http.rb +1 -1
  42. data/lib/appsignal/hooks/que.rb +1 -1
  43. data/lib/appsignal/hooks/rake.rb +1 -1
  44. data/lib/appsignal/hooks/redis.rb +1 -1
  45. data/lib/appsignal/hooks/resque.rb +1 -1
  46. data/lib/appsignal/hooks/shoryuken.rb +2 -4
  47. data/lib/appsignal/hooks/sidekiq.rb +1 -1
  48. data/lib/appsignal/hooks/unicorn.rb +2 -2
  49. data/lib/appsignal/hooks/webmachine.rb +1 -1
  50. data/lib/appsignal/hooks.rb +2 -2
  51. data/lib/appsignal/integrations/active_support_notifications.rb +1 -1
  52. data/lib/appsignal/integrations/capistrano/appsignal.cap +6 -3
  53. data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +5 -4
  54. data/lib/appsignal/integrations/delayed_job_plugin.rb +3 -5
  55. data/lib/appsignal/integrations/grape.rb +1 -1
  56. data/lib/appsignal/integrations/hanami.rb +1 -1
  57. data/lib/appsignal/integrations/object.rb +2 -3
  58. data/lib/appsignal/integrations/padrino.rb +2 -4
  59. data/lib/appsignal/integrations/que.rb +6 -6
  60. data/lib/appsignal/integrations/railtie.rb +72 -0
  61. data/lib/appsignal/integrations/sidekiq.rb +9 -11
  62. data/lib/appsignal/integrations/sinatra.rb +1 -3
  63. data/lib/appsignal/integrations/webmachine.rb +4 -6
  64. data/lib/appsignal/logger.rb +31 -6
  65. data/lib/appsignal/marker.rb +4 -5
  66. data/lib/appsignal/minutely.rb +7 -7
  67. data/lib/appsignal/probes/gvl.rb +9 -4
  68. data/lib/appsignal/probes/helpers.rb +4 -6
  69. data/lib/appsignal/probes/mri.rb +7 -5
  70. data/lib/appsignal/probes/sidekiq.rb +3 -0
  71. data/lib/appsignal/probes.rb +2 -0
  72. data/lib/appsignal/rack/generic_instrumentation.rb +1 -5
  73. data/lib/appsignal/rack/sinatra_instrumentation.rb +3 -5
  74. data/lib/appsignal/rack/streaming_listener.rb +11 -13
  75. data/lib/appsignal/span.rb +5 -5
  76. data/lib/appsignal/system.rb +10 -11
  77. data/lib/appsignal/transaction.rb +49 -25
  78. data/lib/appsignal/transmitter.rb +4 -2
  79. data/lib/appsignal/utils/deprecation_message.rb +2 -0
  80. data/lib/appsignal/utils/hash_sanitizer.rb +1 -1
  81. data/lib/appsignal/utils/integration_logger.rb +5 -3
  82. data/lib/appsignal/utils/json.rb +1 -1
  83. data/lib/appsignal/utils/query_params_sanitizer.rb +1 -1
  84. data/lib/appsignal/version.rb +1 -1
  85. data/lib/appsignal.rb +5 -4
  86. data/lib/puma/plugin/appsignal.rb +16 -18
  87. data/script/lint_git +1 -1
  88. data/spec/lib/appsignal/capistrano2_spec.rb +6 -3
  89. data/spec/lib/appsignal/capistrano3_spec.rb +6 -3
  90. data/spec/lib/appsignal/cli/diagnose/utils_spec.rb +1 -3
  91. data/spec/lib/appsignal/cli/diagnose_spec.rb +33 -30
  92. data/spec/lib/appsignal/cli/install_spec.rb +5 -6
  93. data/spec/lib/appsignal/cli_spec.rb +1 -1
  94. data/spec/lib/appsignal/config_spec.rb +43 -37
  95. data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +11 -5
  96. data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +4 -4
  97. data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +1 -4
  98. data/spec/lib/appsignal/event_formatter_spec.rb +11 -9
  99. data/spec/lib/appsignal/hooks/action_cable_spec.rb +5 -2
  100. data/spec/lib/appsignal/hooks/action_mailer_spec.rb +2 -1
  101. data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +1 -1
  102. data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +1 -1
  103. data/spec/lib/appsignal/hooks/activejob_spec.rb +21 -12
  104. data/spec/lib/appsignal/hooks/data_mapper_spec.rb +1 -0
  105. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +12 -12
  106. data/spec/lib/appsignal/hooks/excon_spec.rb +2 -2
  107. data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +3 -1
  108. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +4 -2
  109. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +2 -1
  110. data/spec/lib/appsignal/hooks_spec.rb +5 -4
  111. data/spec/lib/appsignal/integrations/grape_spec.rb +8 -4
  112. data/spec/lib/appsignal/integrations/hanami_spec.rb +16 -8
  113. data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +2 -4
  114. data/spec/lib/appsignal/integrations/object_spec.rb +6 -1
  115. data/spec/lib/appsignal/integrations/padrino_spec.rb +4 -2
  116. data/spec/lib/appsignal/integrations/railtie_spec.rb +213 -6
  117. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +54 -41
  118. data/spec/lib/appsignal/logger_spec.rb +20 -4
  119. data/spec/lib/appsignal/marker_spec.rb +2 -2
  120. data/spec/lib/appsignal/minutely_spec.rb +3 -3
  121. data/spec/lib/appsignal/probes/gvl_spec.rb +60 -12
  122. data/spec/lib/appsignal/probes/mri_spec.rb +7 -4
  123. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +2 -1
  124. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +2 -1
  125. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +10 -5
  126. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +7 -5
  127. data/spec/lib/appsignal/transaction_spec.rb +20 -13
  128. data/spec/lib/appsignal/utils/data_spec.rb +10 -1
  129. data/spec/lib/appsignal/utils/hash_sanitizer_spec.rb +11 -11
  130. data/spec/lib/appsignal/utils/json_spec.rb +4 -2
  131. data/spec/lib/appsignal_spec.rb +49 -35
  132. data/spec/lib/puma/appsignal_spec.rb +9 -11
  133. data/spec/spec_helper.rb +14 -2
  134. data/spec/support/fixtures/projects/valid/config/appsignal.yml +1 -1
  135. data/spec/support/helpers/config_helpers.rb +2 -1
  136. data/spec/support/helpers/dependency_helper.rb +1 -9
  137. data/spec/support/helpers/std_streams_helper.rb +1 -3
  138. data/spec/support/helpers/wait_for_helper.rb +2 -3
  139. data/spec/support/mocks/appsignal_mock.rb +1 -1
  140. data/spec/support/mocks/fake_gvl_tools.rb +2 -10
  141. data/spec/support/testing.rb +4 -3
  142. metadata +9 -135
data/build_matrix.yml CHANGED
@@ -175,7 +175,7 @@ matrix:
175
175
  - ruby: "3.0.5"
176
176
  - ruby: "3.1.3"
177
177
  - ruby: "3.2.1"
178
- - ruby: "jruby-9.4.0.0"
178
+ - ruby: "jruby-9.4.1.0"
179
179
  gems: "minimal"
180
180
  gems:
181
181
  - gem: "no_dependencies"
@@ -208,21 +208,21 @@ matrix:
208
208
  only:
209
209
  ruby:
210
210
  - "3.0.5"
211
- - "jruby-9.4.0.0"
211
+ - "jruby-9.4.1.0"
212
212
  - gem: "rails-6.1"
213
213
  only:
214
214
  ruby:
215
215
  - "3.0.5"
216
216
  - "3.1.3"
217
217
  - "3.2.1"
218
- - "jruby-9.4.0.0"
218
+ - "jruby-9.4.1.0"
219
219
  - gem: "rails-7.0"
220
220
  only:
221
221
  ruby:
222
222
  - "3.0.5"
223
223
  - "3.1.3"
224
224
  - "3.2.1"
225
- - "jruby-9.4.0.0"
225
+ - "jruby-9.4.1.0"
226
226
  - gem: "sequel"
227
227
  - gem: "sinatra"
228
228
  - gem: "webmachine1"
Binary file
data/ext/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
- require File.expand_path("../base.rb", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("base.rb", __dir__)
2
4
 
3
5
  def local_build?
4
6
  File.exist?(ext_path("appsignal-agent")) &&
@@ -10,27 +12,26 @@ def local_build?
10
12
  end
11
13
 
12
14
  task :default do
13
- begin
14
- fail_install_on_purpose_in_test!
15
+ fail_install_on_purpose_in_test!
16
+
17
+ library_type = "dynamic"
18
+ report["language"]["implementation"] = "jruby"
19
+ report["build"]["library_type"] = library_type
20
+ next unless check_architecture
15
21
 
16
- library_type = "dynamic"
17
- report["language"]["implementation"] = "jruby"
18
- report["build"]["library_type"] = library_type
19
- next unless check_architecture
22
+ if local_build?
23
+ report["build"]["source"] = "local"
24
+ else
25
+ archive = download_archive(library_type)
26
+ next unless archive
27
+ next unless verify_archive(archive, library_type)
20
28
 
21
- if local_build?
22
- report["build"]["source"] = "local"
23
- else
24
- archive = download_archive(library_type)
25
- next unless archive
26
- next unless verify_archive(archive, library_type)
27
- unarchive(archive)
28
- end
29
- successful_installation
30
- rescue => error
31
- fail_installation_with_error(error)
32
- ensure
33
- create_dummy_makefile unless installation_succeeded?
34
- write_report
29
+ unarchive(archive)
35
30
  end
31
+ successful_installation
32
+ rescue => e
33
+ fail_installation_with_error(e)
34
+ ensure
35
+ create_dummy_makefile unless installation_succeeded?
36
+ write_report
36
37
  end
data/ext/agent.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # DO NOT EDIT
2
4
  # This is a generated file by the `rake ship` family of tasks in the
3
5
  # appsignal-agent repository.
data/ext/base.rb CHANGED
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "digest"
2
4
  require "fileutils"
3
5
  require "open-uri"
4
6
  require "zlib"
5
7
  require "json"
6
8
  require "rubygems/package"
7
- require File.expand_path("../../lib/appsignal/version.rb", __FILE__)
8
- require File.expand_path("../../lib/appsignal/system.rb", __FILE__)
9
+ require File.expand_path("../lib/appsignal/version.rb", __dir__)
10
+ require File.expand_path("../lib/appsignal/system.rb", __dir__)
9
11
  require_relative "./agent"
10
12
 
11
- EXT_PATH = File.expand_path("..", __FILE__).freeze
13
+ EXT_PATH = File.expand_path(__dir__).freeze
12
14
 
13
15
  AGENT_PLATFORM = Appsignal::System.agent_platform
14
16
  AGENT_ARCHITECTURE = Appsignal::System.agent_architecture
@@ -62,15 +64,11 @@ def report
62
64
  end
63
65
 
64
66
  def write_report
65
- File.open(File.join(EXT_PATH, "install.report"), "w") do |file|
66
- file.write JSON.generate(report)
67
- end
67
+ File.write(File.join(EXT_PATH, "install.report"), JSON.generate(report))
68
68
  end
69
69
 
70
70
  def create_dummy_makefile
71
- File.open(File.join(EXT_PATH, "Makefile"), "w") do |file|
72
- file.write "default:\nclean:\ninstall:"
73
- end
71
+ File.write(File.join(EXT_PATH, "Makefile"), "default:\nclean:\ninstall:")
74
72
  end
75
73
 
76
74
  def successful_installation
@@ -104,7 +102,8 @@ def check_architecture
104
102
  else
105
103
  abort_installation(
106
104
  "AppSignal currently does not support your system architecture (#{TARGET_TRIPLE})." \
107
- "Please let us know at support@appsignal.com, we aim to support everything our customers run."
105
+ "Please let us know at support@appsignal.com, we aim to support everything " \
106
+ "our customers run."
108
107
  )
109
108
  end
110
109
  end
@@ -134,8 +133,8 @@ def download_archive(type)
134
133
  proxy, _error = http_proxy
135
134
  args = [
136
135
  download_url,
137
- :ssl_ca_cert => CA_CERT_PATH,
138
- :proxy => proxy
136
+ { :ssl_ca_cert => CA_CERT_PATH,
137
+ :proxy => proxy }
139
138
  ]
140
139
  if URI.respond_to?(:open) # rubocop:disable Style/GuardClause
141
140
  return URI.open(*args)
@@ -175,9 +174,7 @@ def unarchive(archive)
175
174
  tar.each do |entry|
176
175
  next unless entry.file?
177
176
 
178
- File.open(ext_path(entry.full_name), "wb") do |f|
179
- f.write(entry.read)
180
- end
177
+ File.binwrite(ext_path(entry.full_name), entry.read)
181
178
  end
182
179
  end
183
180
  store_download_version_on_report
@@ -202,10 +199,10 @@ def http_proxy
202
199
  end
203
200
  return [proxy, error] if proxy
204
201
 
205
- proxy = try_http_proxy_value(ENV["http_proxy"])
202
+ proxy = try_http_proxy_value(ENV.fetch("http_proxy", nil))
206
203
  return [proxy, error] if proxy
207
204
 
208
- proxy = try_http_proxy_value(ENV["HTTP_PROXY"])
205
+ proxy = try_http_proxy_value(ENV.fetch("HTTP_PROXY", nil))
209
206
  return [proxy, error] if proxy
210
207
 
211
208
  [nil, error]
data/ext/extconf.rb CHANGED
@@ -1,4 +1,6 @@
1
- require File.expand_path("../base.rb", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("base.rb", __dir__)
2
4
 
3
5
  def local_build?
4
6
  File.exist?(ext_path("appsignal-agent")) &&
@@ -20,6 +22,7 @@ def install
20
22
  archive = download_archive(library_type)
21
23
  return unless archive
22
24
  return unless verify_archive(archive, library_type)
25
+
23
26
  unarchive(archive)
24
27
  end
25
28
 
@@ -18,7 +18,7 @@ module Appsignal
18
18
  class AuthCheck
19
19
  # Path used on the AppSignal Push API
20
20
  # https://push.appsignal.com/1/auth
21
- ACTION = "auth".freeze
21
+ ACTION = "auth"
22
22
 
23
23
  attr_reader :config
24
24
 
@@ -55,8 +55,8 @@ module Appsignal
55
55
  end
56
56
  [status, result]
57
57
  rescue => e
58
- result = "Something went wrong while trying to "\
59
- "authenticate with AppSignal: #{e}"
58
+ result = "Something went wrong while trying to " \
59
+ "authenticate with AppSignal: #{e}"
60
60
  [nil, result]
61
61
  end
62
62
  end
@@ -7,7 +7,7 @@ Appsignal::Environment.report_enabled("capistrano")
7
7
 
8
8
  if defined?(Capistrano::VERSION) && Gem::Version.new(Capistrano::VERSION) >= Gem::Version.new(3)
9
9
  # Capistrano 3+
10
- load File.expand_path("../integrations/capistrano/appsignal.cap", __FILE__)
10
+ load File.expand_path("integrations/capistrano/appsignal.cap", __dir__)
11
11
  else
12
12
  # Capistrano 2
13
13
  require "appsignal/integrations/capistrano/capistrano_2_tasks"
@@ -52,10 +52,13 @@ module Appsignal
52
52
  puts "Sending demonstration sample data..."
53
53
  if Appsignal::Demo.transmit
54
54
  puts "Demonstration sample data sent!"
55
- puts "It may take about a minute for the data to appear on https://appsignal.com/accounts"
55
+ puts "It may take about a minute for the data to appear on " \
56
+ "https://appsignal.com/accounts"
56
57
  else
57
58
  puts "\nError: Unable to start the AppSignal agent and send data to AppSignal.com."
58
- puts "Please use the diagnose command (https://docs.appsignal.com/ruby/command-line/diagnose.html) to debug your configuration:"
59
+ puts "Please use the diagnose command " \
60
+ "(https://docs.appsignal.com/ruby/command-line/diagnose.html) " \
61
+ "to debug your configuration:"
59
62
  puts
60
63
  puts " bundle exec appsignal diagnose --environment=production"
61
64
  puts
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Appsignal
2
4
  class CLI
3
5
  class Diagnose
@@ -55,6 +57,7 @@ module Appsignal
55
57
  :exists => File.exist?(path)
56
58
  }.tap do |info|
57
59
  next unless info[:exists]
60
+
58
61
  stat = File.stat(path)
59
62
  info[:type] = stat.directory? ? "directory" : "file"
60
63
  info[:mode] = format("%o", stat.mode)
@@ -79,7 +82,7 @@ module Appsignal
79
82
  # Returns the AppSignal gem installation path. The root directory of
80
83
  # this gem.
81
84
  def gem_path
82
- File.expand_path("../../../../../", __FILE__)
85
+ File.expand_path("../../../..", __dir__)
83
86
  end
84
87
  end
85
88
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Appsignal
2
4
  class CLI
3
5
  class Diagnose
@@ -5,15 +7,17 @@ module Appsignal
5
7
  def self.username_for_uid(uid)
6
8
  passwd_struct = Etc.getpwuid(uid)
7
9
  return unless passwd_struct
10
+
8
11
  passwd_struct.name
9
- rescue ArgumentError # rubocop:disable Lint/HandleExceptions
12
+ rescue ArgumentError # rubocop:disable Lint/SuppressedException
10
13
  end
11
14
 
12
15
  def self.group_for_gid(gid)
13
16
  passwd_struct = Etc.getgrgid(gid)
14
17
  return unless passwd_struct
18
+
15
19
  passwd_struct.name
16
- rescue ArgumentError # rubocop:disable Lint/HandleExceptions
20
+ rescue ArgumentError # rubocop:disable Lint/SuppressedException
17
21
  end
18
22
 
19
23
  def self.read_file_content(path, bytes_to_read)
@@ -30,7 +34,7 @@ module Appsignal
30
34
  offset = file_size - bytes_to_read
31
35
  end
32
36
 
33
- IO.binread(path, length, offset)
37
+ File.binread(path, length, offset)
34
38
  end
35
39
  end
36
40
  end
@@ -47,7 +47,7 @@ module Appsignal
47
47
  class Diagnose
48
48
  extend CLI::Helpers
49
49
 
50
- DIAGNOSE_ENDPOINT = "https://appsignal.com/diag".freeze
50
+ DIAGNOSE_ENDPOINT = "https://appsignal.com/diag"
51
51
 
52
52
  module Data
53
53
  def data
@@ -149,7 +149,7 @@ module Appsignal
149
149
  response = transmitter.transmit(:diagnose => data)
150
150
 
151
151
  unless response.code == "200"
152
- puts " Error: Something went wrong while submitting the report "\
152
+ puts " Error: Something went wrong while submitting the report " \
153
153
  "to AppSignal."
154
154
  puts " Response code: #{response.code}"
155
155
  puts " Response body:\n#{response.body}"
@@ -350,7 +350,7 @@ module Appsignal
350
350
  end
351
351
 
352
352
  def fetch_installation_report
353
- path = File.expand_path("../../../../ext/install.report", __FILE__)
353
+ path = File.expand_path("../../../ext/install.report", __dir__)
354
354
  raw_report = File.read(path)
355
355
  JSON.parse(raw_report)
356
356
  rescue StandardError, JSON::ParserError => e # rubocop:disable Lint/ShadowedException
@@ -444,7 +444,8 @@ module Appsignal
444
444
  puts_value "Operating System", os_label
445
445
 
446
446
  distribution_file = "/etc/os-release"
447
- save :os_distribution, File.exist?(distribution_file) ? File.read(distribution_file) : ""
447
+ save :os_distribution,
448
+ File.exist?(distribution_file) ? File.read(distribution_file) : ""
448
449
 
449
450
  language_version = "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"
450
451
  save :language_version, language_version
@@ -518,7 +519,7 @@ module Appsignal
518
519
  end
519
520
  end
520
521
 
521
- puts "\nRead more about how the diagnose config output is rendered\n"\
522
+ puts "\nRead more about how the diagnose config output is rendered\n" \
522
523
  "https://docs.appsignal.com/ruby/command-line/diagnose.html"
523
524
  end
524
525
 
@@ -533,6 +534,7 @@ module Appsignal
533
534
 
534
535
  def config_sources_label(option, sources)
535
536
  return if sources == [:default]
537
+
536
538
  if sources.length == 1
537
539
  " (Loaded from: #{sources.join(", ")})"
538
540
  elsif sources.any?
@@ -16,16 +16,13 @@ module Appsignal
16
16
  :default => 0
17
17
  }.freeze
18
18
 
19
- def ruby_2_6_or_up?
20
- Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6.0")
21
- end
22
-
23
19
  def coloring=(value)
24
20
  @coloring = value
25
21
  end
26
22
 
27
23
  def coloring?
28
24
  return true unless defined?(@coloring)
25
+
29
26
  @coloring
30
27
  end
31
28
 
@@ -67,8 +67,8 @@ module Appsignal
67
67
  install_for_sinatra(config)
68
68
  else
69
69
  print colorize "Warning:", :red
70
- puts " We could not detect which framework you are using. "\
71
- "We'd be very grateful if you email us on support@appsignal.com "\
70
+ puts " We could not detect which framework you are using. " \
71
+ "We'd be very grateful if you email us on support@appsignal.com " \
72
72
  "with information about your setup."
73
73
  puts
74
74
  done_notice
@@ -229,9 +229,7 @@ module Appsignal
229
229
  puts
230
230
  puts "Add the following environment variables to configure AppSignal:"
231
231
  puts " export APPSIGNAL_PUSH_API_KEY=#{config[:push_api_key]}"
232
- if name_overwritten
233
- puts " export APPSIGNAL_APP_NAME=#{config[:name]}"
234
- end
232
+ puts " export APPSIGNAL_APP_NAME=#{config[:name]}" if name_overwritten
235
233
  puts
236
234
  puts " See the documentation for more configuration options:"
237
235
  puts " https://docs.appsignal.com/gem-settings/configuration.html"
@@ -299,11 +297,7 @@ module Appsignal
299
297
  "../../../resources/appsignal.yml.erb"
300
298
  )
301
299
  file_contents = File.read(filename)
302
- template = if ruby_2_6_or_up?
303
- ERB.new(file_contents, :trim_mode => "-")
304
- else
305
- ERB.new(file_contents, nil, "-")
306
- end
300
+ template = ERB.new(file_contents, :trim_mode => "-")
307
301
  config = template.result(OpenStruct.new(data).instance_eval { binding })
308
302
 
309
303
  FileUtils.mkdir_p(File.join(Dir.pwd, "config"))
data/lib/appsignal/cli.rb CHANGED
@@ -34,7 +34,7 @@ module Appsignal
34
34
  Appsignal::CLI::Install.run(argv.shift, options)
35
35
  end
36
36
  else
37
- puts "Command '#{command}' does not exist, run appsignal -h to "\
37
+ puts "Command '#{command}' does not exist, run appsignal -h to " \
38
38
  "see the help"
39
39
  exit(1)
40
40
  end
@@ -79,7 +79,8 @@ module Appsignal
79
79
  o.on "--environment=<app_env>", "The environment to diagnose" do |arg|
80
80
  options[:environment] = arg
81
81
  end
82
- o.on "--[no-]send-report", "Confirm sending the report to AppSignal automatically" do |arg|
82
+ o.on "--[no-]send-report",
83
+ "Confirm sending the report to AppSignal automatically" do |arg|
83
84
  options[:send_report] = arg
84
85
  end
85
86
  o.on "--[no-]color", "Colorize the output of the diagnose command" do |arg|