appsignal 1.1.0.beta.12 → 1.1.0.beta.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/Rakefile +0 -2
- data/gemfiles/grape.gemfile +0 -2
- data/gemfiles/padrino.gemfile +0 -2
- data/gemfiles/rails-3.2.gemfile +0 -2
- data/gemfiles/rails-4.0.gemfile +1 -1
- data/gemfiles/rails-4.1.gemfile +1 -1
- data/gemfiles/rails-4.2.gemfile +1 -1
- data/gemfiles/rails-5.0.gemfile +0 -2
- data/lib/appsignal/auth_check.rb +1 -1
- data/lib/appsignal/cli.rb +13 -42
- data/lib/appsignal/cli/diagnose.rb +72 -0
- data/lib/appsignal/cli/install.rb +296 -0
- data/lib/appsignal/cli/notify_of_deploy.rb +41 -0
- data/lib/appsignal/config.rb +6 -1
- data/lib/appsignal/event_formatter/active_record/sql_formatter.rb +1 -5
- data/lib/appsignal/integrations/capistrano/careful_logger.rb +1 -0
- data/lib/appsignal/integrations/railtie.rb +0 -4
- data/lib/appsignal/version.rb +1 -1
- data/{lib/generators/appsignal/templates/appsignal.yml → resources/appsignal.yml.erb} +4 -4
- data/spec/lib/appsignal/cli/diagnose_spec.rb +27 -0
- data/spec/lib/appsignal/cli/install_spec.rb +438 -0
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +128 -0
- data/spec/lib/appsignal/cli_spec.rb +23 -126
- data/spec/lib/appsignal/config_spec.rb +7 -2
- data/spec/lib/appsignal/integrations/sinatra_spec.rb +1 -12
- data/spec/lib/appsignal_spec.rb +14 -7
- data/spec/spec_helper.rb +16 -4
- data/spec/support/project_fixture/config/application.rb +0 -0
- data/spec/support/project_fixture/config/environments/development.rb +0 -0
- data/spec/support/project_fixture/config/environments/production.rb +0 -0
- data/spec/support/project_fixture/config/environments/test.rb +0 -0
- metadata +19 -6
- data/lib/generators/appsignal/USAGE +0 -8
- data/lib/generators/appsignal/appsignal_generator.rb +0 -64
- data/spec/lib/generators/appsignal/appsignal_generator_spec.rb +0 -156
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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: 1.1.0.beta.
|
4
|
+
version: 1.1.0.beta.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -150,6 +150,9 @@ files:
|
|
150
150
|
- lib/appsignal/auth_check.rb
|
151
151
|
- lib/appsignal/capistrano.rb
|
152
152
|
- lib/appsignal/cli.rb
|
153
|
+
- lib/appsignal/cli/diagnose.rb
|
154
|
+
- lib/appsignal/cli/install.rb
|
155
|
+
- lib/appsignal/cli/notify_of_deploy.rb
|
153
156
|
- lib/appsignal/config.rb
|
154
157
|
- lib/appsignal/event_formatter.rb
|
155
158
|
- lib/appsignal/event_formatter/action_view/render_formatter.rb
|
@@ -197,19 +200,20 @@ files:
|
|
197
200
|
- lib/appsignal/update_active_support.rb
|
198
201
|
- lib/appsignal/utils.rb
|
199
202
|
- lib/appsignal/version.rb
|
200
|
-
- lib/generators/appsignal/USAGE
|
201
|
-
- lib/generators/appsignal/appsignal_generator.rb
|
202
|
-
- lib/generators/appsignal/templates/appsignal.yml
|
203
203
|
- lib/sequel/extensions/appsignal_integration.rb
|
204
204
|
- lib/tasks/diag.rake
|
205
205
|
- lib/vendor/active_support/notifications.rb
|
206
206
|
- lib/vendor/active_support/notifications/fanout.rb
|
207
207
|
- lib/vendor/active_support/notifications/instrumenter.rb
|
208
208
|
- lib/vendor/active_support/per_thread_registry.rb
|
209
|
+
- resources/appsignal.yml.erb
|
209
210
|
- resources/cacert.pem
|
210
211
|
- spec/lib/appsignal/auth_check_spec.rb
|
211
212
|
- spec/lib/appsignal/capistrano2_spec.rb
|
212
213
|
- spec/lib/appsignal/capistrano3_spec.rb
|
214
|
+
- spec/lib/appsignal/cli/diagnose_spec.rb
|
215
|
+
- spec/lib/appsignal/cli/install_spec.rb
|
216
|
+
- spec/lib/appsignal/cli/notify_of_deploy_spec.rb
|
213
217
|
- spec/lib/appsignal/cli_spec.rb
|
214
218
|
- spec/lib/appsignal/config_spec.rb
|
215
219
|
- spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
|
@@ -253,7 +257,6 @@ files:
|
|
253
257
|
- spec/lib/appsignal/update_active_support_spec.rb
|
254
258
|
- spec/lib/appsignal/utils_spec.rb
|
255
259
|
- spec/lib/appsignal_spec.rb
|
256
|
-
- spec/lib/generators/appsignal/appsignal_generator_spec.rb
|
257
260
|
- spec/lib/tmp/config/appsignal.yml
|
258
261
|
- spec/spec_helper.rb
|
259
262
|
- spec/support/delegate_matcher.rb
|
@@ -265,7 +268,11 @@ files:
|
|
265
268
|
- spec/support/helpers/time_helpers.rb
|
266
269
|
- spec/support/helpers/transaction_helpers.rb
|
267
270
|
- spec/support/mocks/mock_extension.rb
|
271
|
+
- spec/support/project_fixture/config/application.rb
|
268
272
|
- spec/support/project_fixture/config/appsignal.yml
|
273
|
+
- spec/support/project_fixture/config/environments/development.rb
|
274
|
+
- spec/support/project_fixture/config/environments/production.rb
|
275
|
+
- spec/support/project_fixture/config/environments/test.rb
|
269
276
|
- spec/support/project_fixture/log/.gitkeep
|
270
277
|
- spec/support/rails/my_app.rb
|
271
278
|
- spec/support/stubs/delayed_job.rb
|
@@ -298,6 +305,9 @@ test_files:
|
|
298
305
|
- spec/lib/appsignal/auth_check_spec.rb
|
299
306
|
- spec/lib/appsignal/capistrano2_spec.rb
|
300
307
|
- spec/lib/appsignal/capistrano3_spec.rb
|
308
|
+
- spec/lib/appsignal/cli/diagnose_spec.rb
|
309
|
+
- spec/lib/appsignal/cli/install_spec.rb
|
310
|
+
- spec/lib/appsignal/cli/notify_of_deploy_spec.rb
|
301
311
|
- spec/lib/appsignal/cli_spec.rb
|
302
312
|
- spec/lib/appsignal/config_spec.rb
|
303
313
|
- spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
|
@@ -341,7 +351,6 @@ test_files:
|
|
341
351
|
- spec/lib/appsignal/update_active_support_spec.rb
|
342
352
|
- spec/lib/appsignal/utils_spec.rb
|
343
353
|
- spec/lib/appsignal_spec.rb
|
344
|
-
- spec/lib/generators/appsignal/appsignal_generator_spec.rb
|
345
354
|
- spec/lib/tmp/config/appsignal.yml
|
346
355
|
- spec/spec_helper.rb
|
347
356
|
- spec/support/delegate_matcher.rb
|
@@ -353,7 +362,11 @@ test_files:
|
|
353
362
|
- spec/support/helpers/time_helpers.rb
|
354
363
|
- spec/support/helpers/transaction_helpers.rb
|
355
364
|
- spec/support/mocks/mock_extension.rb
|
365
|
+
- spec/support/project_fixture/config/application.rb
|
356
366
|
- spec/support/project_fixture/config/appsignal.yml
|
367
|
+
- spec/support/project_fixture/config/environments/development.rb
|
368
|
+
- spec/support/project_fixture/config/environments/production.rb
|
369
|
+
- spec/support/project_fixture/config/environments/test.rb
|
357
370
|
- spec/support/project_fixture/log/.gitkeep
|
358
371
|
- spec/support/rails/my_app.rb
|
359
372
|
- spec/support/stubs/delayed_job.rb
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'appsignal'
|
2
|
-
|
3
|
-
class AppsignalGenerator < Rails::Generators::Base
|
4
|
-
EXCLUDED_ENVIRONMENTS = ['test'].freeze
|
5
|
-
|
6
|
-
source_root File.expand_path('../templates', __FILE__)
|
7
|
-
argument :push_api_key, :type => :string
|
8
|
-
desc 'Generate a config file for AppSignal'
|
9
|
-
|
10
|
-
def copy_config_file
|
11
|
-
template_file = 'appsignal.yml'
|
12
|
-
destination_file = File.join('config', template_file)
|
13
|
-
if File.exists?(destination_file)
|
14
|
-
say_status(:error, 'Looks like you already have a config file', :red)
|
15
|
-
else
|
16
|
-
template(template_file, destination_file)
|
17
|
-
add_appsignal_require_for_capistrano
|
18
|
-
check_push_api_key
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
|
24
|
-
def add_appsignal_require_for_capistrano
|
25
|
-
deploy_file = File.expand_path(File.join('config', 'deploy.rb'))
|
26
|
-
cap_file = File.expand_path('Capfile')
|
27
|
-
if [deploy_file, cap_file].all? { |file| File.exists?(file) }
|
28
|
-
file_contents = File.read(deploy_file)
|
29
|
-
if (file_contents =~ /require (\'|\").\/appsignal\/capistrano/).nil?
|
30
|
-
append_to_file deploy_file, "\nrequire 'appsignal/capistrano'\n"
|
31
|
-
end
|
32
|
-
else
|
33
|
-
say_status :info, "No capistrano setup detected! Did you know you can "\
|
34
|
-
"use the AppSignal CLI to notify AppSignal of deployments?", :yellow
|
35
|
-
say_status "", "Run the following command for help:"
|
36
|
-
say_status "", "appsignal notify_of_deploy -h"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def config
|
41
|
-
Appsignal::Config.new(
|
42
|
-
Rails.root,
|
43
|
-
'development'
|
44
|
-
)
|
45
|
-
end
|
46
|
-
|
47
|
-
def check_push_api_key
|
48
|
-
auth_check = ::Appsignal::AuthCheck.new(config, Appsignal.logger)
|
49
|
-
status, result = auth_check.perform_with_result
|
50
|
-
if status == '200'
|
51
|
-
say_status :success, result
|
52
|
-
else
|
53
|
-
say_status :error, result, :red
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
def environments
|
60
|
-
@environments ||= Dir.glob(
|
61
|
-
File.join(%w(. config environments *.rb))
|
62
|
-
).map { |o| File.basename(o, ".rb") }.sort - EXCLUDED_ENVIRONMENTS
|
63
|
-
end
|
64
|
-
end
|
@@ -1,156 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
if rails_present?
|
4
|
-
require 'generator_spec/test_case'
|
5
|
-
require './lib/generators/appsignal/appsignal_generator'
|
6
|
-
|
7
|
-
# The generator doesn't know we're testing
|
8
|
-
# So change the path while running the generator
|
9
|
-
# Change it back upon completion
|
10
|
-
def run_generator_in_tmp(args=[])
|
11
|
-
FileUtils.cd(tmp_dir) do
|
12
|
-
FileUtils.mkdir_p('config/environments')
|
13
|
-
FileUtils.touch('config/environments/development.rb')
|
14
|
-
FileUtils.touch('config/environments/production.rb')
|
15
|
-
@output = run_generator(args)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe AppsignalGenerator do
|
20
|
-
include GeneratorSpec::TestCase
|
21
|
-
destination tmp_dir
|
22
|
-
|
23
|
-
let(:authcheck) { Appsignal::AuthCheck.new(nil, nil) }
|
24
|
-
let(:err_stream) { StringIO.new }
|
25
|
-
|
26
|
-
before do
|
27
|
-
Appsignal::AuthCheck.stub(:new => authcheck)
|
28
|
-
FileUtils.rm_rf(tmp_dir)
|
29
|
-
@original_stderr = $stderr
|
30
|
-
$stderr = err_stream
|
31
|
-
end
|
32
|
-
after do
|
33
|
-
$stderr = @original_stderr
|
34
|
-
end
|
35
|
-
|
36
|
-
context "with key" do
|
37
|
-
context "known key" do
|
38
|
-
before do
|
39
|
-
authcheck.should_receive(:perform).and_return('200')
|
40
|
-
|
41
|
-
prepare_destination
|
42
|
-
run_generator_in_tmp %w(my_app_key)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should generate a correct config file" do
|
46
|
-
fixture_config_file = File.open(File.join(fixtures_dir, 'generated_config.yml')).read
|
47
|
-
generated_config_file = File.open(File.join(tmp_dir, 'config/appsignal.yml')).read
|
48
|
-
|
49
|
-
generated_config_file.should == fixture_config_file
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should mention successful auth check" do
|
53
|
-
@output.should include('AppSignal has confirmed authorization!')
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context "invalid key" do
|
58
|
-
before do
|
59
|
-
authcheck.should_receive(:perform).and_return('401')
|
60
|
-
|
61
|
-
prepare_destination
|
62
|
-
run_generator_in_tmp %w(my_app_key)
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should mention invalid key" do
|
66
|
-
@output.should include('error')
|
67
|
-
@output.should include('API key not valid with AppSignal...')
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context "failed check" do
|
72
|
-
before do
|
73
|
-
authcheck.should_receive(:perform).and_return('500')
|
74
|
-
|
75
|
-
prepare_destination
|
76
|
-
run_generator_in_tmp %w(my_app_key)
|
77
|
-
end
|
78
|
-
|
79
|
-
it "should mention failed check" do
|
80
|
-
@output.should include('error')
|
81
|
-
@output.should include('Could not confirm authorization')
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
context "without key" do
|
87
|
-
before do
|
88
|
-
prepare_destination
|
89
|
-
run_generator_in_tmp %w()
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should not create a config file" do
|
93
|
-
destination_root.should have_structure {
|
94
|
-
directory 'config' do
|
95
|
-
no_file 'appsignal.yml'
|
96
|
-
no_file 'deploy.rb'
|
97
|
-
end
|
98
|
-
}
|
99
|
-
err_stream.string.should include "No value provided for required arguments 'push_api_key'"
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context "without capistrano" do
|
104
|
-
before do
|
105
|
-
prepare_destination
|
106
|
-
authcheck.stub(:perform).and_return(['200', 'everything ok'])
|
107
|
-
run_generator_in_tmp %w(my_app_key)
|
108
|
-
end
|
109
|
-
|
110
|
-
it "should create a config file" do
|
111
|
-
destination_root.should have_structure {
|
112
|
-
directory 'config' do
|
113
|
-
file 'appsignal.yml'
|
114
|
-
no_file 'deploy.rb'
|
115
|
-
end
|
116
|
-
}
|
117
|
-
end
|
118
|
-
|
119
|
-
it "should mention the deploy task" do
|
120
|
-
@output.should include('No capistrano setup detected!')
|
121
|
-
@output.should include('appsignal notify_of_deploy -h')
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
context "with capistrano" do
|
126
|
-
before do
|
127
|
-
cap_file = File.join(destination_root, 'Capfile')
|
128
|
-
deploy_file = File.join(destination_root, 'config', 'deploy.rb')
|
129
|
-
|
130
|
-
prepare_destination
|
131
|
-
File.open(cap_file, 'w') {}
|
132
|
-
FileUtils.mkdir(File.join(destination_root, 'config'))
|
133
|
-
File.open(deploy_file, 'w') {}
|
134
|
-
authcheck.stub(:perform).and_return(['200', 'everything ok'])
|
135
|
-
run_generator_in_tmp %w(my_app_key)
|
136
|
-
end
|
137
|
-
|
138
|
-
it "should create a config file and modify the capistrano deploy file" do
|
139
|
-
destination_root.should have_structure {
|
140
|
-
file 'Capfile'
|
141
|
-
directory 'config' do
|
142
|
-
file 'appsignal.yml'
|
143
|
-
file 'deploy.rb' do
|
144
|
-
contains "require 'appsignal/capistrano'"
|
145
|
-
end
|
146
|
-
end
|
147
|
-
}
|
148
|
-
end
|
149
|
-
|
150
|
-
it "should not mention the deploy task" do
|
151
|
-
@output.should_not include('No capistrano setup detected!')
|
152
|
-
@output.should_not include('appsignal notify_of_deploy -h')
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|