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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14065029a6e6ad196fbacb9fd1ddd627e5cc24a0
4
- data.tar.gz: 16183261b3782e15c9c16c25f8308e02b35aa3c3
3
+ metadata.gz: 986496cd10d45daa766ee0cd11a7c96d3242082c
4
+ data.tar.gz: cb30b172c8d9f4cb1f4ae0d3bab206838b726a51
5
5
  SHA512:
6
- metadata.gz: 70b557fd01a44caf8f0c6a6fae9739341817c6826f4b130a97309f5a73bfb3ec09b6a6caf8ca25f1e46733c2c7b914737b4411bdf4f3736bd53643cc31441065
7
- data.tar.gz: 5259c0cd88cefa2d6f069bbf79c7c096ca297b3ec50f3d0306b8dce9ba2865b283a79bf5c78d10ce153600f626c943c0a716ed1f6e0f806f57e8d3ad74f0de39
6
+ metadata.gz: 5e5c9efab7379fdcfbb91cb9281cc0970a93704ec16232c6b855ea10716adbb6d12513b449aad52f5ef6f89681a0cb951f42de4b72c3d018c46c4f3a5a9fe323
7
+ data.tar.gz: 0680c1e4ae6e6f383ab5dd41fba9d7db395cb6c5ef7adadf952e48ed8f91156c54f2fa7e4e9409c6131dbdf36a3d9f89ef1efb773bf026499282eb10df316adc
@@ -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
@@ -0,0 +1,15 @@
1
+ module Crashbreak
2
+ class ForkExceptionNotifier
3
+ def notify
4
+ fork do
5
+ exception_notifier.notify
6
+ end
7
+ end
8
+
9
+ private
10
+
11
+ def exception_notifier
12
+ @exception_notifier ||= ExceptionNotifier.new
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Crashbreak
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.7'
3
3
  end
@@ -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
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.6
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-04-23 00:00:00.000000000 Z
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/request_sender_spec.rb
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/request_sender_spec.rb
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