appsignal 3.12.5-java → 3.12.6-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/lib/appsignal/cli/install.rb +75 -45
- data/lib/appsignal/config.rb +7 -3
- data/lib/appsignal/helpers/instrumentation.rb +5 -0
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +7 -3
- data/spec/lib/appsignal/cli/install_spec.rb +114 -41
- data/spec/lib/appsignal/config_spec.rb +24 -0
- data/spec/lib/appsignal_spec.rb +52 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce8c0391c3c8485fa6d27fea9e9fbacef73817be6e614e10f4c8c3e83ee8c164
|
4
|
+
data.tar.gz: 39137b4064d8cd060ef32ce59ca7fe1e66066179673d44ef099af149908feb66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b560264e085cfabf54b662d41ef2483be4fec6c349ffd3f8500bd7b2a5f60c70a2d380b9c0da40f13692fc090f5006d2bf1530c4a6baeebcd9dd6f3f67df8edc
|
7
|
+
data.tar.gz: 666e8ff6f6ceb7526c40be3b6cd6b8082209181644fe2538ca3a587b2299a71330210dfaea59656075707a112addbf8f5e96cce224f24db7afb5bf10048812db
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,40 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 3.12.6
|
4
|
+
|
5
|
+
_Published on 2024-08-05._
|
6
|
+
|
7
|
+
### Changed
|
8
|
+
|
9
|
+
- Configure AppSignal with the install CLI when no known frameworks is found. Automate the configure step so that this doesn't have to be done manually along with the manual setup for the app. (patch [a9c546fa](https://github.com/appsignal/appsignal-ruby/commit/a9c546fa86afbec290cd8439a559bf60cad21fc8))
|
10
|
+
|
11
|
+
### Deprecated
|
12
|
+
|
13
|
+
- Deprecate the `Appsignal.listen_for_error` helper. Use a manual error rescue with `Appsignal.report_error`. This method allows for more customization of the reported error.
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
# Before
|
17
|
+
Appsignal.listen_for_error do
|
18
|
+
raise "some error"
|
19
|
+
end
|
20
|
+
|
21
|
+
begin
|
22
|
+
raise "some error"
|
23
|
+
rescue => error
|
24
|
+
Appsignal.report_error(error)
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
Read our [Exception handling guide](https://docs.appsignal.com/ruby/instrumentation/exception-handling.html) for more information.
|
29
|
+
|
30
|
+
(patch [14bd8882](https://github.com/appsignal/appsignal-ruby/commit/14bd88824dea2993cb0165bbbed0def29d69f72a))
|
31
|
+
- Deprecate the `Appsignal.configure`'s `app_path` writer. Use the `Appsignal.configure`'s `root_path` keyword argument to configure the path. (patch [c79f46c3](https://github.com/appsignal/appsignal-ruby/commit/c79f46c3cd96ac51726a963f38999bfb3c246d52))
|
32
|
+
|
33
|
+
### Fixed
|
34
|
+
|
35
|
+
- Fix an error on the Padrino require in the installer CLI. The latest Padrino version will crash the installer on load. Ignore the error when it fails to load. (patch [dfe23707](https://github.com/appsignal/appsignal-ruby/commit/dfe23707f769ff818714ee7cf14340f9472ce2e4))
|
36
|
+
- Fix the `Appsignal.configure` path config not being customizable. It's now possible to pass a `root_path` keyword argument to `Appsignal.configure` to customize the path from which AppSignal reads the config file, `config/appsignal.yml`. (patch [c79f46c3](https://github.com/appsignal/appsignal-ruby/commit/c79f46c3cd96ac51726a963f38999bfb3c246d52))
|
37
|
+
|
3
38
|
## 3.12.5
|
4
39
|
|
5
40
|
_Published on 2024-08-01._
|
@@ -18,16 +18,16 @@ module Appsignal
|
|
18
18
|
$stdout.sync = true
|
19
19
|
|
20
20
|
puts
|
21
|
-
puts colorize "
|
22
|
-
puts colorize "## Starting AppSignal Installer
|
23
|
-
puts colorize "##
|
24
|
-
puts colorize "## Need help? support@appsignal.com
|
25
|
-
puts colorize "## Docs
|
26
|
-
puts colorize "
|
21
|
+
puts colorize "############################################", :green
|
22
|
+
puts colorize "## Starting AppSignal Installer ##", :green
|
23
|
+
puts colorize "## -------------------------------------- ##", :green
|
24
|
+
puts colorize "## Need help? support@appsignal.com ##", :green
|
25
|
+
puts colorize "## Docs: https://docs.appsignal.com ##", :green
|
26
|
+
puts colorize "############################################", :green
|
27
27
|
puts
|
28
28
|
unless push_api_key
|
29
29
|
puts colorize "Problem encountered:", :red
|
30
|
-
puts " No
|
30
|
+
puts " No Push API key entered."
|
31
31
|
puts " - Sign up for AppSignal and follow the instructions"
|
32
32
|
puts " - Already signed up? Click 'Add app' on the account overview page"
|
33
33
|
puts
|
@@ -37,22 +37,25 @@ module Appsignal
|
|
37
37
|
config = new_config
|
38
38
|
config[:push_api_key] = push_api_key
|
39
39
|
|
40
|
-
print "Validating API key"
|
40
|
+
print "Validating Push API key"
|
41
41
|
periods
|
42
42
|
puts
|
43
43
|
begin
|
44
44
|
auth_check = Appsignal::AuthCheck.new(config)
|
45
45
|
unless auth_check.perform == "200"
|
46
|
-
|
46
|
+
print colorize(" Error:", :red)
|
47
|
+
puts " Push API key '#{config[:push_api_key]}' is not valid. " \
|
48
|
+
"Please get a new one at https://appsignal.com/accounts"
|
47
49
|
return
|
48
50
|
end
|
49
51
|
rescue => e
|
50
|
-
|
52
|
+
print colorize(" Error:", :red)
|
53
|
+
puts "There was an error validating your Push API key:"
|
51
54
|
puts colorize "'#{e}'", :red
|
52
|
-
puts " Please try again"
|
55
|
+
puts " Please check the Push API key and try again"
|
53
56
|
return
|
54
57
|
end
|
55
|
-
puts colorize " API key valid!", :green
|
58
|
+
puts colorize " Push API key valid!", :green
|
56
59
|
puts
|
57
60
|
|
58
61
|
if installed_frameworks.include?(:rails)
|
@@ -66,12 +69,7 @@ module Appsignal
|
|
66
69
|
elsif installed_frameworks.include?(:sinatra)
|
67
70
|
install_for_sinatra(config)
|
68
71
|
else
|
69
|
-
|
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
|
-
"with information about your setup."
|
73
|
-
puts
|
74
|
-
done_notice
|
72
|
+
install_for_unknown_framework(config)
|
75
73
|
end
|
76
74
|
end
|
77
75
|
|
@@ -119,11 +117,18 @@ module Appsignal
|
|
119
117
|
puts
|
120
118
|
configure(config, %w[development production staging], true)
|
121
119
|
|
122
|
-
puts "
|
123
|
-
puts " Sinatra requires some manual
|
124
|
-
puts "
|
120
|
+
puts "Sinatra installation"
|
121
|
+
puts " Sinatra apps requires some manual setup."
|
122
|
+
puts " Update the `config.ru` (or the application's main file) to " \
|
123
|
+
"look like this:"
|
124
|
+
puts
|
125
|
+
puts %(require "appsignal")
|
126
|
+
puts %(require "sinatra" # or require "sinatra/base")
|
125
127
|
puts
|
126
|
-
puts "
|
128
|
+
puts "Appsignal.load(:sinatra) # Load the Sinatra integration"
|
129
|
+
puts "Appsignal.start # Start AppSignal"
|
130
|
+
puts
|
131
|
+
puts "# Rest of the config.ru file"
|
127
132
|
puts
|
128
133
|
puts " You can find more information in the documentation:"
|
129
134
|
puts " https://docs.appsignal.com/ruby/integrations/sinatra.html"
|
@@ -137,11 +142,14 @@ module Appsignal
|
|
137
142
|
puts
|
138
143
|
configure(config, %w[development production staging], true)
|
139
144
|
|
140
|
-
puts "
|
141
|
-
puts " Padrino requires some manual
|
142
|
-
puts " After installing the gem, add the following
|
145
|
+
puts "Padrino installation"
|
146
|
+
puts " Padrino apps requires some manual setup."
|
147
|
+
puts " After installing the gem, add the following lines to `config/boot.rb`:"
|
148
|
+
puts
|
149
|
+
puts %(require "appsignal")
|
143
150
|
puts
|
144
|
-
puts "
|
151
|
+
puts "Appsignal.load(:padrino) # Load the Padrino integration"
|
152
|
+
puts "Appsignal.start # Start AppSignal"
|
145
153
|
puts
|
146
154
|
puts " You can find more information in the documentation:"
|
147
155
|
puts " https://docs.appsignal.com/ruby/integrations/padrino.html"
|
@@ -157,7 +165,8 @@ module Appsignal
|
|
157
165
|
|
158
166
|
configure(config, %w[development production staging], true)
|
159
167
|
|
160
|
-
puts "
|
168
|
+
puts "Grape installation"
|
169
|
+
puts " Grape apps require some manual setup."
|
161
170
|
puts " See the installation instructions at:"
|
162
171
|
puts " https://docs.appsignal.com/ruby/integrations/grape.html"
|
163
172
|
press_any_key
|
@@ -170,11 +179,17 @@ module Appsignal
|
|
170
179
|
puts
|
171
180
|
configure(config, %w[development production staging], true)
|
172
181
|
|
173
|
-
puts "
|
174
|
-
puts " Hanami requires some manual
|
175
|
-
puts "
|
182
|
+
puts "Hanami installation"
|
183
|
+
puts " Hanami apps requires some manual setup."
|
184
|
+
puts " Update the config.ru file to include the following:"
|
185
|
+
puts
|
186
|
+
puts %( require "appsignal")
|
187
|
+
puts %( require "hanami/boot")
|
176
188
|
puts
|
177
|
-
puts "
|
189
|
+
puts "Appsignal.load(:hanami) # Load the Hanami integration"
|
190
|
+
puts "Appsignal.start # Start AppSignal"
|
191
|
+
puts
|
192
|
+
puts "# Rest of the config.ru file"
|
178
193
|
puts
|
179
194
|
puts " You can find more information in the documentation:"
|
180
195
|
puts " https://docs.appsignal.com/ruby/integrations/hanami.html"
|
@@ -197,6 +212,23 @@ module Appsignal
|
|
197
212
|
puts
|
198
213
|
end
|
199
214
|
|
215
|
+
def install_for_unknown_framework(config)
|
216
|
+
puts "Installing"
|
217
|
+
config[:name] = required_input(" Enter application name: ")
|
218
|
+
puts
|
219
|
+
configure(config, %w[development production staging], true)
|
220
|
+
|
221
|
+
puts colorize "Warning: We could not detect which framework you are using", :red
|
222
|
+
puts " Some manual installation is most likely required."
|
223
|
+
puts " Please check our documentation for supported libraries: "
|
224
|
+
puts " https://docs.appsignal.com/ruby/integrations.html"
|
225
|
+
puts
|
226
|
+
puts " We'd be very grateful if you email us on " \
|
227
|
+
"support@appsignal.com with information about your setup."
|
228
|
+
press_any_key
|
229
|
+
done_notice
|
230
|
+
end
|
231
|
+
|
200
232
|
def configure(config, environments, name_overwritten)
|
201
233
|
install_for_capistrano
|
202
234
|
|
@@ -240,29 +272,27 @@ module Appsignal
|
|
240
272
|
end
|
241
273
|
|
242
274
|
def done_notice
|
243
|
-
sleep 0.3
|
244
|
-
puts colorize "#####################################", :green
|
245
|
-
puts colorize "## AppSignal installation complete ##", :green
|
246
|
-
puts colorize "#####################################", :green
|
247
|
-
sleep 0.3
|
248
|
-
puts
|
249
275
|
if Gem.win_platform?
|
250
|
-
|
276
|
+
print colorize "Warning:", :red
|
277
|
+
puts " The AppSignal agent currently does not work on Microsoft " \
|
251
278
|
"Windows. Please push these changes to your staging/production " \
|
252
279
|
"environment and make sure some actions are performed. " \
|
253
|
-
"AppSignal
|
280
|
+
"AppSignal will pick up your app after a few minutes."
|
254
281
|
else
|
255
|
-
puts "
|
282
|
+
puts "Sending example data to AppSignal..."
|
256
283
|
if Appsignal::Demo.transmit
|
257
284
|
puts " Example data sent!"
|
258
285
|
puts " It may take about a minute for the data to appear on https://appsignal.com/accounts"
|
259
|
-
puts
|
260
|
-
puts " Please return to your browser and follow the instructions."
|
261
286
|
else
|
262
|
-
|
263
|
-
puts "
|
287
|
+
print colorize "Error:", :red
|
288
|
+
puts " Couldn't start the AppSignal agent and send example data to AppSignal.com"
|
289
|
+
puts " Please contact us at support@appsignal.com and " \
|
290
|
+
"send us a diagnose report using `appsignal diagnose`."
|
291
|
+
return
|
264
292
|
end
|
265
293
|
end
|
294
|
+
puts
|
295
|
+
puts "Please return to your browser and follow the instructions."
|
266
296
|
end
|
267
297
|
|
268
298
|
def installed_frameworks
|
@@ -281,7 +311,7 @@ module Appsignal
|
|
281
311
|
def framework_available?(framework_file)
|
282
312
|
require framework_file
|
283
313
|
true
|
284
|
-
rescue LoadError
|
314
|
+
rescue LoadError, NameError
|
285
315
|
false
|
286
316
|
end
|
287
317
|
|
data/lib/appsignal/config.rb
CHANGED
@@ -212,7 +212,7 @@ module Appsignal
|
|
212
212
|
# Initialize a new configuration object for AppSignal.
|
213
213
|
#
|
214
214
|
# @param root_path [String] Root path of the app.
|
215
|
-
# @param
|
215
|
+
# @param initial_env [String] The environment to load when AppSignal is started. It
|
216
216
|
# will look for an environment with this name in the `config/appsignal.yml`
|
217
217
|
# config file.
|
218
218
|
# @param initial_config [Hash<String, Object>] The initial configuration to
|
@@ -622,8 +622,12 @@ module Appsignal
|
|
622
622
|
@config.root_path
|
623
623
|
end
|
624
624
|
|
625
|
-
def app_path=(
|
626
|
-
|
625
|
+
def app_path=(_path)
|
626
|
+
Appsignal::Utils::StdoutAndLoggerMessage.warning \
|
627
|
+
"The `Appsignal.configure`'s `app_path=` writer is deprecated " \
|
628
|
+
"and can no longer be used to set the root path. " \
|
629
|
+
"Use the `Appsignal.configure`'s method `root_path` keyword argument " \
|
630
|
+
"to set the root path."
|
627
631
|
end
|
628
632
|
|
629
633
|
def env
|
@@ -309,6 +309,11 @@ module Appsignal
|
|
309
309
|
tags = nil,
|
310
310
|
namespace = Appsignal::Transaction::HTTP_REQUEST
|
311
311
|
)
|
312
|
+
stdout_and_logger_warning \
|
313
|
+
"The `Appsignal.listen_for_error` helper is deprecated. " \
|
314
|
+
"Please use `rescue => error` and `Appsignal.report_error` instead. " \
|
315
|
+
"Read our exception handling documentation: " \
|
316
|
+
"https://docs.appsignal.com/ruby/instrumentation/exception-handling.html"
|
312
317
|
yield
|
313
318
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
314
319
|
send_error(error) do |transaction|
|
data/lib/appsignal/version.rb
CHANGED
data/lib/appsignal.rb
CHANGED
@@ -228,24 +228,28 @@ module Appsignal
|
|
228
228
|
# # Or for the environment given as an argument
|
229
229
|
# Appsignal.configure(:production)
|
230
230
|
#
|
231
|
+
# @param env [String, Symbol] The environment to load.
|
232
|
+
# @param root_path [String] The path to look the `config/appsignal.yml` config file in.
|
233
|
+
# Defaults to the current working directory.
|
231
234
|
# @yield [Config] Gives the {Config} instance to the block.
|
232
235
|
# @return [void]
|
233
236
|
# @see config
|
234
237
|
# @see Config
|
235
238
|
# @see https://docs.appsignal.com/ruby/configuration.html Configuration guide
|
236
239
|
# @see https://docs.appsignal.com/ruby/configuration/options.html Configuration options
|
237
|
-
def configure(env = nil)
|
240
|
+
def configure(env = nil, root_path: nil)
|
238
241
|
if Appsignal.started?
|
239
242
|
Appsignal.internal_logger
|
240
243
|
.warn("AppSignal is already started. Ignoring `Appsignal.configure` call.")
|
241
244
|
return
|
242
245
|
end
|
243
246
|
|
244
|
-
if config && (env.nil? || config.env == env.to_s)
|
247
|
+
if config && ((env.nil? || config.env == env.to_s) &&
|
248
|
+
(root_path.nil? || config.root_path == root_path))
|
245
249
|
config
|
246
250
|
else
|
247
251
|
@config = Config.new(
|
248
|
-
Config.determine_root_path,
|
252
|
+
root_path || Config.determine_root_path,
|
249
253
|
Config.determine_env(env),
|
250
254
|
{},
|
251
255
|
Appsignal.internal_logger,
|
@@ -30,7 +30,7 @@ describe Appsignal::CLI::Install do
|
|
30
30
|
|
31
31
|
define :include_complete_install do
|
32
32
|
match do |actual|
|
33
|
-
actual.include?("
|
33
|
+
actual.include?("Please return to your browser and follow the instructions.")
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -105,7 +105,7 @@ describe Appsignal::CLI::Install do
|
|
105
105
|
run
|
106
106
|
|
107
107
|
expect(output).to include "Problem encountered:",
|
108
|
-
"No
|
108
|
+
"No Push API key entered"
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -120,7 +120,7 @@ describe Appsignal::CLI::Install do
|
|
120
120
|
choose_environment_config
|
121
121
|
run
|
122
122
|
|
123
|
-
expect(output).to include("Validating API key...", "API key valid")
|
123
|
+
expect(output).to include("Validating Push API key...", "Push API key valid")
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -129,7 +129,7 @@ describe Appsignal::CLI::Install do
|
|
129
129
|
|
130
130
|
it "prints an error" do
|
131
131
|
run
|
132
|
-
expect(output).to include "API key 'my_key' is not valid"
|
132
|
+
expect(output).to include "Push API key 'my_key' is not valid"
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
@@ -140,7 +140,7 @@ describe Appsignal::CLI::Install do
|
|
140
140
|
|
141
141
|
it "prints an error" do
|
142
142
|
run
|
143
|
-
expect(output).to include "There was an error validating your API key"
|
143
|
+
expect(output).to include "There was an error validating your Push API key"
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
@@ -419,14 +419,16 @@ describe Appsignal::CLI::Install do
|
|
419
419
|
expect(File.exist?(File.join(config_dir, "application.rb"))).to eql(false)
|
420
420
|
end
|
421
421
|
|
422
|
-
it "
|
422
|
+
it "falls back on the unknown framework installation" do
|
423
|
+
enter_app_name app_name
|
424
|
+
choose_environment_config
|
423
425
|
run
|
424
426
|
|
425
|
-
expect(output)
|
427
|
+
expect(output)
|
428
|
+
.to include("\e[31mWarning: We could not detect which framework you are using\e[0m")
|
426
429
|
expect(output).to_not include("Installing for Ruby on Rails")
|
430
|
+
expect(output).to include_env_push_api_key(push_api_key)
|
427
431
|
expect(output).to include_complete_install
|
428
|
-
|
429
|
-
expect(File.exist?(config_file_path)).to be(false)
|
430
432
|
end
|
431
433
|
end
|
432
434
|
|
@@ -465,8 +467,10 @@ describe Appsignal::CLI::Install do
|
|
465
467
|
let(:installation_instructions) do
|
466
468
|
[
|
467
469
|
"Installing for Sinatra",
|
468
|
-
"Sinatra requires some manual
|
469
|
-
|
470
|
+
"Sinatra apps requires some manual setup.",
|
471
|
+
%(require "appsignal"),
|
472
|
+
"Appsignal.load(:sinatra)",
|
473
|
+
"Appsignal.start",
|
470
474
|
"https://docs.appsignal.com/ruby/integrations/sinatra.html"
|
471
475
|
]
|
472
476
|
end
|
@@ -533,7 +537,10 @@ describe Appsignal::CLI::Install do
|
|
533
537
|
let(:installation_instructions) do
|
534
538
|
[
|
535
539
|
"Installing for Padrino",
|
536
|
-
"Padrino requires some manual
|
540
|
+
"Padrino apps requires some manual setup.",
|
541
|
+
%(require "appsignal"),
|
542
|
+
"Appsignal.load(:padrino)",
|
543
|
+
"Appsignal.start",
|
537
544
|
"https://docs.appsignal.com/ruby/integrations/padrino.html"
|
538
545
|
]
|
539
546
|
end
|
@@ -600,7 +607,7 @@ describe Appsignal::CLI::Install do
|
|
600
607
|
let(:installation_instructions) do
|
601
608
|
[
|
602
609
|
"Installing for Grape",
|
603
|
-
"
|
610
|
+
"Grape apps require some manual setup.",
|
604
611
|
"https://docs.appsignal.com/ruby/integrations/grape.html"
|
605
612
|
]
|
606
613
|
end
|
@@ -624,6 +631,7 @@ describe Appsignal::CLI::Install do
|
|
624
631
|
it "completes the installation" do
|
625
632
|
run
|
626
633
|
|
634
|
+
puts output
|
627
635
|
expect(output).to include(*installation_instructions)
|
628
636
|
expect(output).to include_complete_install
|
629
637
|
end
|
@@ -667,7 +675,10 @@ describe Appsignal::CLI::Install do
|
|
667
675
|
let(:installation_instructions) do
|
668
676
|
[
|
669
677
|
"Installing for Hanami",
|
670
|
-
"Hanami requires some manual
|
678
|
+
"Hanami apps requires some manual setup.",
|
679
|
+
%(require "appsignal"),
|
680
|
+
"Appsignal.load(:hanami)",
|
681
|
+
"Appsignal.start",
|
671
682
|
"https://docs.appsignal.com/ruby/integrations/hanami.html"
|
672
683
|
]
|
673
684
|
end
|
@@ -728,47 +739,109 @@ describe Appsignal::CLI::Install do
|
|
728
739
|
!hanami2_present?
|
729
740
|
context "with unknown framework" do
|
730
741
|
let(:push_api_key) { "my_key" }
|
742
|
+
let(:app_name) { "Test app" }
|
731
743
|
|
732
|
-
it_behaves_like "windows installation"
|
733
744
|
it_behaves_like "push_api_key validation"
|
734
|
-
it_behaves_like "
|
745
|
+
it_behaves_like "requires an application name"
|
746
|
+
|
747
|
+
describe "unknown framework specific tests" do
|
748
|
+
let(:installation_instructions) do
|
749
|
+
[
|
750
|
+
"Installing",
|
751
|
+
"\e[31mWarning: We could not detect which framework you are using\e[0m",
|
752
|
+
"Some manual installation is most likely required.",
|
753
|
+
"https://docs.appsignal.com/ruby/integrations.html"
|
754
|
+
]
|
755
|
+
end
|
756
|
+
before { enter_app_name app_name }
|
735
757
|
|
736
|
-
|
737
|
-
|
758
|
+
describe "configuration with environment variables" do
|
759
|
+
before { choose_environment_config }
|
738
760
|
|
739
|
-
|
740
|
-
|
741
|
-
|
761
|
+
it_behaves_like "windows installation"
|
762
|
+
it_behaves_like "capistrano install"
|
763
|
+
it_behaves_like "demo data"
|
764
|
+
|
765
|
+
it "prints environment variables" do
|
766
|
+
run
|
767
|
+
|
768
|
+
expect(output).to include_env_push_api_key(push_api_key)
|
769
|
+
expect(output).to include_env_app_name(app_name)
|
770
|
+
end
|
771
|
+
|
772
|
+
it "completes the installation" do
|
773
|
+
run
|
774
|
+
|
775
|
+
expect(output).to include(*installation_instructions)
|
776
|
+
expect(output).to include_complete_install
|
777
|
+
end
|
742
778
|
end
|
743
|
-
end
|
744
779
|
|
745
|
-
|
746
|
-
|
780
|
+
describe "configure with a configuration file" do
|
781
|
+
before { choose_config_file }
|
747
782
|
|
748
|
-
|
749
|
-
|
750
|
-
|
783
|
+
it_behaves_like "windows installation"
|
784
|
+
it_behaves_like "capistrano install"
|
785
|
+
it_behaves_like "demo data"
|
786
|
+
|
787
|
+
it "writes configuration to file" do
|
788
|
+
run
|
789
|
+
expect(output).to include_file_config
|
790
|
+
expect(config_file).to configure_app_name(app_name)
|
791
|
+
expect(config_file).to configure_push_api_key(push_api_key)
|
792
|
+
expect(config_file).to configure_environment("development")
|
793
|
+
expect(config_file).to configure_environment("staging")
|
794
|
+
expect(config_file).to configure_environment("production")
|
795
|
+
end
|
796
|
+
|
797
|
+
it "completes the installation" do
|
798
|
+
run
|
799
|
+
|
800
|
+
expect(output).to include(*installation_instructions)
|
801
|
+
expect(output).to include_complete_install
|
802
|
+
end
|
751
803
|
end
|
752
804
|
end
|
753
805
|
|
754
|
-
|
755
|
-
|
806
|
+
describe "color flag" do
|
807
|
+
before do
|
808
|
+
enter_app_name "Test app"
|
809
|
+
choose_environment_config
|
810
|
+
end
|
756
811
|
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
812
|
+
context "without color options" do
|
813
|
+
let(:options) { {} }
|
814
|
+
|
815
|
+
it "prints the instructions in color" do
|
816
|
+
run
|
817
|
+
expect(output).to have_colorized_text(
|
818
|
+
:green,
|
819
|
+
"## Starting AppSignal Installer ##"
|
820
|
+
)
|
821
|
+
end
|
761
822
|
end
|
762
|
-
end
|
763
823
|
|
764
|
-
|
765
|
-
|
824
|
+
context "with --color option" do
|
825
|
+
let(:options) { { "color" => nil } }
|
766
826
|
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
827
|
+
it "prints the instructions in color" do
|
828
|
+
run
|
829
|
+
expect(output).to have_colorized_text(
|
830
|
+
:green,
|
831
|
+
"## Starting AppSignal Installer ##"
|
832
|
+
)
|
833
|
+
end
|
834
|
+
end
|
835
|
+
|
836
|
+
context "with --no-color option" do
|
837
|
+
let(:options) { { "no-color" => nil } }
|
838
|
+
|
839
|
+
it "prints the instructions without special colors" do
|
840
|
+
run
|
841
|
+
expect(output).to include("## Starting AppSignal Installer ##")
|
842
|
+
expect(output).to_not have_color_markers
|
843
|
+
end
|
844
|
+
end
|
772
845
|
end
|
773
846
|
end
|
774
847
|
end
|
@@ -1439,5 +1439,29 @@ describe Appsignal::Config do
|
|
1439
1439
|
|
1440
1440
|
expect(dsl.cpu_count).to eq(1.0)
|
1441
1441
|
end
|
1442
|
+
|
1443
|
+
describe "#app_path=" do
|
1444
|
+
it "prints a deprecation warning" do
|
1445
|
+
err_stream = std_stream
|
1446
|
+
capture_std_streams(std_stream, err_stream) do
|
1447
|
+
dsl.app_path = "foo"
|
1448
|
+
end
|
1449
|
+
|
1450
|
+
expect(err_stream.read).to include(
|
1451
|
+
"appsignal WARNING: The `Appsignal.configure`'s `app_path=` writer is deprecated"
|
1452
|
+
)
|
1453
|
+
end
|
1454
|
+
|
1455
|
+
it "logs a deprecation warning" do
|
1456
|
+
logs = capture_logs do
|
1457
|
+
silence { dsl.app_path = "foo" }
|
1458
|
+
end
|
1459
|
+
|
1460
|
+
expect(logs).to contains_log(
|
1461
|
+
:warn,
|
1462
|
+
"The `Appsignal.configure`'s `app_path=` writer is deprecated"
|
1463
|
+
)
|
1464
|
+
end
|
1465
|
+
end
|
1442
1466
|
end
|
1443
1467
|
end
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -125,6 +125,28 @@ describe Appsignal do
|
|
125
125
|
expect(Appsignal.config[:push_api_key]).to eq("key")
|
126
126
|
end
|
127
127
|
|
128
|
+
it "loads a new config if the path is not the same" do
|
129
|
+
Appsignal._config = Appsignal::Config.new(
|
130
|
+
"/some/path",
|
131
|
+
:my_env,
|
132
|
+
:name => "Some name",
|
133
|
+
:push_api_key => "Some key",
|
134
|
+
:ignore_actions => ["My action"]
|
135
|
+
)
|
136
|
+
|
137
|
+
Appsignal.configure(:my_env, :root_path => project_fixture_path) do |config|
|
138
|
+
expect(config.ignore_actions).to be_empty
|
139
|
+
config.active = true
|
140
|
+
config.name = "My app"
|
141
|
+
config.push_api_key = "key"
|
142
|
+
end
|
143
|
+
expect(Appsignal.config.valid?).to be(true)
|
144
|
+
expect(Appsignal.config.env).to eq("my_env")
|
145
|
+
expect(Appsignal.config[:active]).to be(true)
|
146
|
+
expect(Appsignal.config[:name]).to eq("My app")
|
147
|
+
expect(Appsignal.config[:push_api_key]).to eq("key")
|
148
|
+
end
|
149
|
+
|
128
150
|
it "calls configure if not started yet" do
|
129
151
|
Appsignal.configure(:my_env) do |config|
|
130
152
|
config.active = false
|
@@ -165,6 +187,16 @@ describe Appsignal do
|
|
165
187
|
expect(Appsignal.config.env).to eq("env_arg")
|
166
188
|
end
|
167
189
|
|
190
|
+
it "uses the given root path to read the config file" do
|
191
|
+
Appsignal.configure(:test, :root_path => project_fixture_path)
|
192
|
+
|
193
|
+
Appsignal.start
|
194
|
+
expect(Appsignal.config.env).to eq("test")
|
195
|
+
expect(Appsignal.config[:push_api_key]).to eq("abc")
|
196
|
+
# Ensure it loads from the config file in the given path
|
197
|
+
expect(Appsignal.config.file_config).to_not be_empty
|
198
|
+
end
|
199
|
+
|
168
200
|
it "loads the config without a block being given" do
|
169
201
|
Dir.chdir project_fixture_path do
|
170
202
|
Appsignal.configure(:test)
|
@@ -172,6 +204,8 @@ describe Appsignal do
|
|
172
204
|
|
173
205
|
expect(Appsignal.config.env).to eq("test")
|
174
206
|
expect(Appsignal.config[:push_api_key]).to eq("abc")
|
207
|
+
# Ensure it loads from the config file in the current working directory
|
208
|
+
expect(Appsignal.config.file_config).to_not be_empty
|
175
209
|
end
|
176
210
|
|
177
211
|
it "allows customization of config in the block" do
|
@@ -1571,6 +1605,24 @@ describe Appsignal do
|
|
1571
1605
|
describe ".listen_for_error" do
|
1572
1606
|
around { |example| keep_transactions { example.run } }
|
1573
1607
|
|
1608
|
+
it "prints and logs a deprecation warning" do
|
1609
|
+
err_stream = std_stream
|
1610
|
+
logs =
|
1611
|
+
capture_logs do
|
1612
|
+
capture_std_streams(std_stream, err_stream) do
|
1613
|
+
Appsignal.listen_for_error do
|
1614
|
+
# Do nothing
|
1615
|
+
end
|
1616
|
+
end
|
1617
|
+
end
|
1618
|
+
expect(err_stream.read)
|
1619
|
+
.to include("appsignal WARNING: The `Appsignal.listen_for_error` helper is deprecated.")
|
1620
|
+
expect(logs).to contains_log(
|
1621
|
+
:warn,
|
1622
|
+
"The `Appsignal.listen_for_error` helper is deprecated."
|
1623
|
+
)
|
1624
|
+
end
|
1625
|
+
|
1574
1626
|
it "records the error and re-raise it" do
|
1575
1627
|
expect do
|
1576
1628
|
expect do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.12.
|
4
|
+
version: 3.12.6
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-08-
|
13
|
+
date: 2024-08-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -502,7 +502,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
502
502
|
- !ruby/object:Gem::Version
|
503
503
|
version: '0'
|
504
504
|
requirements: []
|
505
|
-
rubygems_version: 3.
|
505
|
+
rubygems_version: 3.5.14
|
506
506
|
signing_key:
|
507
507
|
specification_version: 4
|
508
508
|
summary: Logs performance and exception data from your app to appsignal.com
|