crashbreak 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crashbreak.rb +2 -0
- data/lib/crashbreak/deploys_repository.rb +32 -0
- data/lib/crashbreak/fork_exception_notifier.rb +15 -0
- data/lib/crashbreak/version.rb +1 -1
- data/lib/tasks/crashbreak.cap +29 -0
- data/spec/lib/deploys_repository_spec.rb +16 -0
- data/spec/lib/{request_sender_spec.rb → request_parser_spec.rb} +0 -0
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 986496cd10d45daa766ee0cd11a7c96d3242082c
|
4
|
+
data.tar.gz: cb30b172c8d9f4cb1f4ae0d3bab206838b726a51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e5c9efab7379fdcfbb91cb9281cc0970a93704ec16232c6b855ea10716adbb6d12513b449aad52f5ef6f89681a0cb951f42de4b72c3d018c46c4f3a5a9fe323
|
7
|
+
data.tar.gz: 0680c1e4ae6e6f383ab5dd41fba9d7db395cb6c5ef7adadf952e48ed8f91156c54f2fa7e4e9409c6131dbdf36a3d9f89ef1efb773bf026499282eb10df316adc
|
data/lib/crashbreak.rb
CHANGED
@@ -18,12 +18,14 @@ require 'crashbreak/config/configurator'
|
|
18
18
|
require 'crashbreak/config/configurable'
|
19
19
|
require 'crashbreak/exception_catcher_middleware'
|
20
20
|
require 'crashbreak/exceptions_repository'
|
21
|
+
require 'crashbreak/deploys_repository'
|
21
22
|
require 'crashbreak/dumpers_data_repository'
|
22
23
|
require 'crashbreak/request_parser'
|
23
24
|
require 'crashbreak/github_integration_service'
|
24
25
|
require 'crashbreak/AWS'
|
25
26
|
require 'crashbreak/async_exception_notifier'
|
26
27
|
require 'crashbreak/tiny_exception_notifier'
|
28
|
+
require 'crashbreak/fork_exception_notifier'
|
27
29
|
|
28
30
|
require 'dumpers/database_dumper'
|
29
31
|
require 'dumpers/request_dumper'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Crashbreak
|
2
|
+
class DeploysRepository
|
3
|
+
BASE_URL = 'http://crashbreak.herokuapp.com/api'
|
4
|
+
|
5
|
+
def initialize(project_token, deploy_hash)
|
6
|
+
@project_token = project_token
|
7
|
+
@deploy_hash = deploy_hash
|
8
|
+
end
|
9
|
+
|
10
|
+
def create
|
11
|
+
post_request.body
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def post_request
|
17
|
+
connection.post do |req|
|
18
|
+
req.url create_deploy_url
|
19
|
+
req.body = @deploy_hash.to_json
|
20
|
+
req.headers['Content-Type'] = 'application/json'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def connection
|
25
|
+
Faraday.new
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_deploy_url
|
29
|
+
"#{BASE_URL}/projects/#{@project_token}/deploys"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/crashbreak/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
namespace :crashbreak do
|
2
|
+
|
3
|
+
desc 'Send the deployment notification to Crashbreak.'
|
4
|
+
task :deploy do
|
5
|
+
on roles fetch(:crashbreak_role) do
|
6
|
+
deploy_hash = {
|
7
|
+
user: fetch(:crashbreak_user),
|
8
|
+
environment: fetch(:crashbreak_env),
|
9
|
+
head: fetch(:current_revision)
|
10
|
+
}
|
11
|
+
|
12
|
+
Crashbreak::DeployRepository.new(crashbreak_token, deploy_hash).create
|
13
|
+
info 'Notification complete.'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :deploy do
|
19
|
+
after 'deploy:finished', 'crashbreak:deploy'
|
20
|
+
end
|
21
|
+
|
22
|
+
namespace :load do
|
23
|
+
task :defaults do
|
24
|
+
set :crashbreak_user, Proc.new { ENV['USER'] || ENV['USERNAME'] }
|
25
|
+
set :crashbreak_env, Proc.new { fetch :rails_env, 'production' }
|
26
|
+
set :crashbreak_token, Proc.new { abort "Please specify the Crashbreak access token, set :crashbreak_token, 'your token'" }
|
27
|
+
set :crashbreak_role, Proc.new { :app }
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
describe Crashbreak::DeploysRepository do
|
2
|
+
subject { described_class.new example_project_token, deploy_hash }
|
3
|
+
|
4
|
+
let(:example_project_token) { 'fake_project_token' }
|
5
|
+
let(:deploy_hash) { Hash[user: 'test_user@heroku.com', head: '0b5fb19', environment: 'production']}
|
6
|
+
|
7
|
+
let!(:create_deploy_request) {
|
8
|
+
stub_request(:post, "#{described_class::BASE_URL}/projects/#{example_project_token}/deploys").
|
9
|
+
with(body: deploy_hash.to_json)
|
10
|
+
}
|
11
|
+
|
12
|
+
it 'sends request with deploy information' do
|
13
|
+
subject.create
|
14
|
+
expect(create_deploy_request).to have_been_made
|
15
|
+
end
|
16
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crashbreak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Janeczek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -227,10 +227,12 @@ files:
|
|
227
227
|
- lib/crashbreak/async_exception_notifier.rb
|
228
228
|
- lib/crashbreak/config/configurable.rb
|
229
229
|
- lib/crashbreak/config/configurator.rb
|
230
|
+
- lib/crashbreak/deploys_repository.rb
|
230
231
|
- lib/crashbreak/dumpers_data_repository.rb
|
231
232
|
- lib/crashbreak/exception_catcher_middleware.rb
|
232
233
|
- lib/crashbreak/exception_notifier.rb
|
233
234
|
- lib/crashbreak/exceptions_repository.rb
|
235
|
+
- lib/crashbreak/fork_exception_notifier.rb
|
234
236
|
- lib/crashbreak/formatters/basic_formatter.rb
|
235
237
|
- lib/crashbreak/formatters/basic_information_formatter.rb
|
236
238
|
- lib/crashbreak/formatters/default_summary_formatter.rb
|
@@ -250,12 +252,14 @@ files:
|
|
250
252
|
- lib/restorers/database_restorer.rb
|
251
253
|
- lib/restorers/request_restorer.rb
|
252
254
|
- lib/restorers/state_restorer.rb
|
255
|
+
- lib/tasks/crashbreak.cap
|
253
256
|
- lib/tasks/crashbreak.rake
|
254
257
|
- spec/dumpers/request_dumper_spec.rb
|
255
258
|
- spec/features/sending_error_report_spec.rb
|
256
259
|
- spec/lib/async_exception_notifier_spec.rb
|
257
260
|
- spec/lib/config/configurable_spec.rb
|
258
261
|
- spec/lib/config/configurator_spec.rb
|
262
|
+
- spec/lib/deploys_repository_spec.rb
|
259
263
|
- spec/lib/dumpers_data_repository_spec.rb
|
260
264
|
- spec/lib/exception_catcher_middleware_spec.rb
|
261
265
|
- spec/lib/exception_notifier_spec.rb
|
@@ -267,7 +271,7 @@ files:
|
|
267
271
|
- spec/lib/generators/install_generator_spec.rb
|
268
272
|
- spec/lib/generators/test_generator_spec.rb
|
269
273
|
- spec/lib/github_integration_service_spec.rb
|
270
|
-
- spec/lib/
|
274
|
+
- spec/lib/request_parser_spec.rb
|
271
275
|
- spec/restorers/state_restorer_spec.rb
|
272
276
|
- spec/spec_helper.rb
|
273
277
|
- spec/support/crashbreak_config.rb
|
@@ -304,6 +308,7 @@ test_files:
|
|
304
308
|
- spec/lib/async_exception_notifier_spec.rb
|
305
309
|
- spec/lib/config/configurable_spec.rb
|
306
310
|
- spec/lib/config/configurator_spec.rb
|
311
|
+
- spec/lib/deploys_repository_spec.rb
|
307
312
|
- spec/lib/dumpers_data_repository_spec.rb
|
308
313
|
- spec/lib/exception_catcher_middleware_spec.rb
|
309
314
|
- spec/lib/exception_notifier_spec.rb
|
@@ -315,7 +320,7 @@ test_files:
|
|
315
320
|
- spec/lib/generators/install_generator_spec.rb
|
316
321
|
- spec/lib/generators/test_generator_spec.rb
|
317
322
|
- spec/lib/github_integration_service_spec.rb
|
318
|
-
- spec/lib/
|
323
|
+
- spec/lib/request_parser_spec.rb
|
319
324
|
- spec/restorers/state_restorer_spec.rb
|
320
325
|
- spec/spec_helper.rb
|
321
326
|
- spec/support/crashbreak_config.rb
|