crashbreak 0.9.11 → 0.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/Gemfile +1 -5
- data/README.md +1 -1
- data/crashbreak.gemspec +1 -0
- data/lib/crashbreak/config/configurator.rb +5 -0
- data/lib/crashbreak/exception_notifier.rb +6 -1
- data/lib/crashbreak/request_parser.rb +5 -1
- data/lib/crashbreak/version.rb +1 -1
- data/spec/lib/exception_notifier_spec.rb +26 -1
- data/spec/lib/github_integration_service_spec.rb +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f6183abe751a1cecd33a2d52399434823e0773e
|
4
|
+
data.tar.gz: fcee46ef8ef7ac9226fd47432be4a22ddc8a96cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f834ad2ead2fe48eb87c995495b9bb30f4e16a546f3fc931953cc0ac7222f68a5910560fffb64c2ea80a0f1791102035023541e221db25ec58e48b026d98fabd
|
7
|
+
data.tar.gz: c27afe53f5cded9b28afed5cf409cfa4155d09f8155324d618a3a47aefc9c913daf1248bd0d2c1bae218e7f5069a6a65b63ca06cd1b6067eff7eed065bd2d811
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Crashbreak
|
1
|
+
# Crashbreak [![Version](http://img.shields.io/gem/v/crashbreak.svg) ](https://rubygems.org/gems/crashbreak) [![Build Status](https://travis-ci.org/crashbreak/crashbreak.svg?branch=master)](https://travis-ci.org/crashbreak/crashbreak) [![Code Climate](https://codeclimate.com/github/crashbreak/crashbreak/badges/gpa.svg)](https://codeclimate.com/github/crashbreak/crashbreak)
|
2
2
|
|
3
3
|
TODO: Write a gem description
|
4
4
|
|
data/crashbreak.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency 'webmock'
|
24
24
|
spec.add_development_dependency 'simplecov'
|
25
25
|
spec.add_development_dependency 'deepstruct'
|
26
|
+
spec.add_development_dependency 'generator_spec'
|
26
27
|
|
27
28
|
spec.add_runtime_dependency 'faraday', '>= 0'
|
28
29
|
spec.add_runtime_dependency 'request_store', '>= 0'
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Crashbreak
|
2
2
|
class Configurator
|
3
3
|
attr_accessor :api_key
|
4
|
+
attr_accessor :ignored_environments
|
4
5
|
attr_accessor :exception_notifier
|
5
6
|
attr_accessor :error_serializers
|
6
7
|
attr_accessor :dumpers
|
@@ -17,6 +18,10 @@ module Crashbreak
|
|
17
18
|
@exception_notifier || ExceptionNotifier.new
|
18
19
|
end
|
19
20
|
|
21
|
+
def ignored_environments
|
22
|
+
@ignored_environments || ['development']
|
23
|
+
end
|
24
|
+
|
20
25
|
def error_serializers
|
21
26
|
@error_serializers || []
|
22
27
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module Crashbreak
|
2
2
|
class ExceptionNotifier
|
3
3
|
def notify
|
4
|
+
return if skip_exception?
|
4
5
|
response = exceptions_repository.create serialize_exception
|
5
|
-
GithubIntegrationService.new(response).push_test if Crashbreak.configure.github_repo_name.present?
|
6
|
+
GithubIntegrationService.new(response).push_test if Crashbreak.configure.github_repo_name.present? && response['similar'] == false
|
6
7
|
end
|
7
8
|
|
8
9
|
private
|
@@ -22,6 +23,10 @@ module Crashbreak
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
26
|
+
def skip_exception?
|
27
|
+
Crashbreak.configure.ignored_environments.include? ENV['RACK_ENV']
|
28
|
+
end
|
29
|
+
|
25
30
|
def dumpers
|
26
31
|
Crashbreak.configure.dumpers
|
27
32
|
end
|
@@ -27,7 +27,11 @@ module Crashbreak
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def request_headers
|
30
|
-
|
30
|
+
{}.tap do |request_headers|
|
31
|
+
@request.select{|key| key.start_with?('HTTP_')}.each do |key, value|
|
32
|
+
request_headers[key.gsub('HTTP_', '')] = value
|
33
|
+
end
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
data/lib/crashbreak/version.rb
CHANGED
@@ -61,8 +61,26 @@ describe Crashbreak::ExceptionNotifier do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
context 'skipping environment' do
|
65
|
+
before(:each) do
|
66
|
+
expect_any_instance_of(Crashbreak::ExceptionsRepository).to_not receive(:create)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'skips development environment by default' do
|
70
|
+
expect(ENV).to receive(:[]).with('RACK_ENV').and_return('development')
|
71
|
+
subject.notify
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'skips all environments in config' do
|
75
|
+
Crashbreak.configure.ignored_environments = ['staging']
|
76
|
+
|
77
|
+
expect(ENV).to receive(:[]).with('RACK_ENV').and_return('staging')
|
78
|
+
subject.notify
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
64
82
|
context 'github integration' do
|
65
|
-
let(:error_hash) { Hash[id: 1, deploy_revision: 'test'] }
|
83
|
+
let(:error_hash) { Hash[id: 1, deploy_revision: 'test', similar: false] }
|
66
84
|
|
67
85
|
it 'passes error hash from request to github integration service' do
|
68
86
|
Crashbreak.configure.github_repo_name = 'user/repo'
|
@@ -72,6 +90,13 @@ describe Crashbreak::ExceptionNotifier do
|
|
72
90
|
|
73
91
|
subject.notify
|
74
92
|
end
|
93
|
+
|
94
|
+
it 'skips github integration if error is similar' do
|
95
|
+
allow_any_instance_of(Crashbreak::ExceptionsRepository).to receive(:create).and_return(error_hash.merge(similar: true))
|
96
|
+
expect_any_instance_of(Crashbreak::GithubIntegrationService).to_not receive(:initialize)
|
97
|
+
|
98
|
+
subject.notify
|
99
|
+
end
|
75
100
|
end
|
76
101
|
end
|
77
102
|
end
|
@@ -15,6 +15,7 @@ describe Crashbreak::GithubIntegrationService do
|
|
15
15
|
|
16
16
|
before(:each) do
|
17
17
|
Crashbreak.configure.github_spec_file_path = 'spec/crashbreak_error_spec.rb'
|
18
|
+
allow_any_instance_of(WebMock::Response).to receive(:assert_valid_body!).and_return(true)
|
18
19
|
end
|
19
20
|
|
20
21
|
it 'pushes test to github' do
|
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: 0.9.
|
4
|
+
version: 0.9.12
|
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-
|
11
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: generator_spec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: faraday
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,6 +216,7 @@ files:
|
|
202
216
|
- ".gitignore"
|
203
217
|
- ".rspec"
|
204
218
|
- ".ruby-version"
|
219
|
+
- ".travis.yml"
|
205
220
|
- Gemfile
|
206
221
|
- LICENSE.txt
|
207
222
|
- README.md
|