exception_notification-idobata 0.0.2 → 0.0.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 352f43ae3d2cd73331781cc480d0c529aedb88d5
|
4
|
+
data.tar.gz: d8a55027f2bbebf7e97632162dd81c9b77e02282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a3fd4b7dfe424065aca217e148c355ef2fce1f5eb9395719f004f0709bda319864d00ec19b78a2534f154f4f1c20179f4d9167a4404a0b86e4e7b05aef00b6f
|
7
|
+
data.tar.gz: 20f27fe15d9b36884fccebb061e28612f178556057e97074dc113d905bbcc62508aca052bc5425ca78854af733fcce438b26462c4165b4062f46653c4ececdcd
|
@@ -6,11 +6,9 @@ module ExceptionNotifier
|
|
6
6
|
attr_reader :url
|
7
7
|
|
8
8
|
def initialize(options)
|
9
|
-
|
10
|
-
raise ArgumentError, 'Endpoint must be specified'
|
11
|
-
end
|
9
|
+
@options = extract_global_options(options, :url, :skip_library_backtrace)
|
12
10
|
|
13
|
-
|
11
|
+
raise(ArgumentError, 'Endpoint must be specified') unless @url
|
14
12
|
end
|
15
13
|
|
16
14
|
def call(exception, options={})
|
@@ -29,6 +27,12 @@ module ExceptionNotifier
|
|
29
27
|
|
30
28
|
private
|
31
29
|
|
30
|
+
def extract_global_options(options, *global_option_names)
|
31
|
+
options.dup.tap do |opts|
|
32
|
+
global_option_names.each {|name| instance_variable_set "@#{name}", opts.delete(name) }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
32
36
|
def request_option(request)
|
33
37
|
{
|
34
38
|
'URL' => request.original_url,
|
@@ -65,11 +69,11 @@ module ExceptionNotifier
|
|
65
69
|
def format_backtrace(trace)
|
66
70
|
trace.map { |line|
|
67
71
|
if from_bundler?(line)
|
68
|
-
line.sub(bundle_root, '[bundle]...')
|
72
|
+
@skip_library_backtrace ? nil : line.sub(bundle_root, '[bundle]...')
|
69
73
|
else
|
70
74
|
line.sub(app_root, '[app]...')
|
71
75
|
end
|
72
|
-
}
|
76
|
+
}.compact
|
73
77
|
end
|
74
78
|
|
75
79
|
def from_bundler?(line)
|
@@ -85,5 +89,6 @@ module ExceptionNotifier
|
|
85
89
|
def app_root
|
86
90
|
Dir.pwd
|
87
91
|
end
|
92
|
+
|
88
93
|
end
|
89
94
|
end
|
@@ -14,6 +14,32 @@ describe ExceptionNotifier::IdobataNotifier do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
context 'option :skip_library_backtrace => true' do
|
18
|
+
describe '#build_message' do
|
19
|
+
let(:notifier) do
|
20
|
+
ExceptionNotifier::IdobataNotifier.new(
|
21
|
+
:url => 'https://idobata.io/hook/endpoint',
|
22
|
+
:skip_library_backtrace => true,
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
let(:library_trace) { 'gems/exception_notification-4.0.1/lib/exception_notifier.rb' }
|
27
|
+
|
28
|
+
let(:exception) do
|
29
|
+
StandardError.new('hello world').tap do |e|
|
30
|
+
e.set_backtrace([
|
31
|
+
[__FILE__, __LINE__].join(':'),
|
32
|
+
"#{Bundler.bundle_path + library_trace}:1"
|
33
|
+
])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
subject(:message) { notifier.send(:build_message, exception, {}) }
|
38
|
+
|
39
|
+
specify { expect(message).not_to include(library_trace) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
17
43
|
describe '#build_message' do
|
18
44
|
let(:exception) { StandardError.new('hello, world') }
|
19
45
|
let(:backtrace) { ['spec/exception_notifier/idobata_notifier_spec.rb'] }
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exception_notification-idobata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Yoshida
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: exception_notification
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rest-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.5'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 3.0.0.beta2
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 3.0.0.beta2
|
83
83
|
description: exception_notification for Idobata
|
@@ -87,9 +87,9 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .rspec
|
92
|
-
- .travis.yml
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
93
|
- Gemfile
|
94
94
|
- LICENSE.txt
|
95
95
|
- README.md
|
@@ -110,17 +110,17 @@ require_paths:
|
|
110
110
|
- lib
|
111
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- -
|
113
|
+
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
|
-
- -
|
118
|
+
- - ">="
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.0
|
123
|
+
rubygems_version: 2.2.0
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: exception_notification for Idobata
|