airbrake-ruby 1.7.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/airbrake-ruby.rb +35 -7
- data/lib/airbrake-ruby/config.rb +5 -0
- data/lib/airbrake-ruby/notifier.rb +0 -1
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/airbrake_spec.rb +3 -3
- data/spec/config_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd52bfc797145037c7aa2c4ba9193b860b6a48f4
|
4
|
+
data.tar.gz: 2314e4ba463a99416df04c209c2af159e6b384c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da90297990ebb7d1b8ba092750a666ef9324cdd6149195d4d143fb9d74d0963793a9696a403bc5011b8675bab3b8ff5c0c881061d89568e225ef0575a0ad0597
|
7
|
+
data.tar.gz: e18299029cd90b600fab49d0867874a3e66f6950c3f882dc1b1c2ab3930846d9de59cb3673afb539926eb1c56c019955d1d3834b51b16d7dea366627e4836b6d
|
data/lib/airbrake-ruby.rb
CHANGED
@@ -53,7 +53,7 @@ require 'airbrake-ruby/notifier'
|
|
53
53
|
#
|
54
54
|
# # Send an exception via other configured notifier.
|
55
55
|
# params = {}
|
56
|
-
# Airbrake.notify('Oops', params
|
56
|
+
# Airbrake[:my_other_project].notify('Oops', params)
|
57
57
|
#
|
58
58
|
# @see Airbrake::Notifier
|
59
59
|
# @since v1.0.0
|
@@ -77,6 +77,18 @@ module Airbrake
|
|
77
77
|
@notifiers = {}
|
78
78
|
|
79
79
|
class << self
|
80
|
+
##
|
81
|
+
# Retrieves configured notifiers.
|
82
|
+
#
|
83
|
+
# @example
|
84
|
+
# Airbrake[:my_notifier].notify('oops')
|
85
|
+
#
|
86
|
+
# @return [Airbrake::Notifier, nil]
|
87
|
+
# @since v1.8.0
|
88
|
+
def [](notifier_name)
|
89
|
+
@notifiers[notifier_name]
|
90
|
+
end
|
91
|
+
|
80
92
|
##
|
81
93
|
# Configures a new +notifier+ with the given name. If the name is not given,
|
82
94
|
# configures the default notifier.
|
@@ -139,7 +151,8 @@ module Airbrake
|
|
139
151
|
# tab in your project's dashboard
|
140
152
|
# @return [Airbrake::Promise]
|
141
153
|
# @see .notify_sync
|
142
|
-
def notify(exception, params = {}, notifier = :default)
|
154
|
+
def notify(exception, params = {}, notifier = (no_arg = true && :default))
|
155
|
+
deprecation_warn(__method__, notifier) unless no_arg
|
143
156
|
call_notifier(notifier, __method__, exception, params)
|
144
157
|
end
|
145
158
|
|
@@ -153,7 +166,8 @@ module Airbrake
|
|
153
166
|
#
|
154
167
|
# @return [Hash{String=>String}] the reponse from the server
|
155
168
|
# @see .notify
|
156
|
-
def notify_sync(exception, params = {}, notifier = :default)
|
169
|
+
def notify_sync(exception, params = {}, notifier = (no_arg = true && :default))
|
170
|
+
deprecation_warn(__method__, notifier) unless no_arg
|
157
171
|
call_notifier(notifier, __method__, exception, params)
|
158
172
|
end
|
159
173
|
|
@@ -184,7 +198,8 @@ module Airbrake
|
|
184
198
|
# @yieldreturn [void]
|
185
199
|
# @return [void]
|
186
200
|
# @note Once a filter was added, there's no way to delete it
|
187
|
-
def add_filter(filter = nil, notifier = :default, &block)
|
201
|
+
def add_filter(filter = nil, notifier = (no_arg = true && :default), &block)
|
202
|
+
deprecation_warn(__method__, notifier) unless no_arg
|
188
203
|
call_notifier(notifier, __method__, filter, &block)
|
189
204
|
end
|
190
205
|
|
@@ -204,7 +219,8 @@ module Airbrake
|
|
204
219
|
# @param [Hash] params The additional params attached to the notice
|
205
220
|
# @return [Airbrake::Notice] the notice built with help of the given
|
206
221
|
# arguments
|
207
|
-
def build_notice(exception, params = {}, notifier = :default)
|
222
|
+
def build_notice(exception, params = {}, notifier = (no_arg = true && :default))
|
223
|
+
deprecation_warn(__method__, notifier) unless no_arg
|
208
224
|
call_notifier(notifier, __method__, exception, params)
|
209
225
|
end
|
210
226
|
|
@@ -219,7 +235,8 @@ module Airbrake
|
|
219
235
|
# Airbrake.notify('App crashed!') #=> raises Airbrake::Error
|
220
236
|
#
|
221
237
|
# @return [void]
|
222
|
-
def close(notifier = :default)
|
238
|
+
def close(notifier = (no_arg = true && :default))
|
239
|
+
deprecation_warn(__method__, notifier) unless no_arg
|
223
240
|
call_notifier(notifier, __method__)
|
224
241
|
end
|
225
242
|
|
@@ -235,7 +252,8 @@ module Airbrake
|
|
235
252
|
# @option deploy_params [Symbol] :revision
|
236
253
|
# @option deploy_params [Symbol] :version
|
237
254
|
# @return [void]
|
238
|
-
def create_deploy(deploy_params, notifier = :default)
|
255
|
+
def create_deploy(deploy_params, notifier = (no_arg = true && :default))
|
256
|
+
deprecation_warn(__method__, notifier) unless no_arg
|
239
257
|
call_notifier(notifier, __method__, deploy_params)
|
240
258
|
end
|
241
259
|
|
@@ -252,5 +270,15 @@ module Airbrake
|
|
252
270
|
def configured?(notifier)
|
253
271
|
@notifiers.key?(notifier)
|
254
272
|
end
|
273
|
+
|
274
|
+
def deprecation_warn(method, notifier)
|
275
|
+
warn(
|
276
|
+
"#{LOG_LABEL} `Airbrake.#{method}` method signature was changed. " \
|
277
|
+
"Passing `notifier_name` is deprecated and will be removed in the " \
|
278
|
+
"next MAJOR release.\n" \
|
279
|
+
"Use `Airbrake[:#{notifier}]` to access the :#{notifier} notifier " \
|
280
|
+
"and call same methods directly on it."
|
281
|
+
)
|
282
|
+
end
|
255
283
|
end
|
256
284
|
end
|
data/lib/airbrake-ruby/config.rb
CHANGED
data/spec/airbrake_spec.rb
CHANGED
@@ -78,7 +78,7 @@ RSpec.describe Airbrake do
|
|
78
78
|
# rubocop:disable Metrics/LineLength
|
79
79
|
expected_body = %r|
|
80
80
|
{"errors":\[{"type":"RuntimeError","message":"bingo","backtrace":\[
|
81
|
-
{"file":"[\
|
81
|
+
{"file":"\[PROJECT_ROOT\]/spec/airbrake_spec.rb","line":\d+,"function":"[\w/\s\(\)<>]+"},
|
82
82
|
{"file":"\[GEM_ROOT\]/gems/rspec-core-.+/.+","line":\d+,"function":"[\w/\s\(\)<>]+"}
|
83
83
|
|x
|
84
84
|
# rubocop:enable Metrics/LineLength
|
@@ -167,11 +167,11 @@ RSpec.describe Airbrake do
|
|
167
167
|
filter_chain = notifier.instance_variable_get(:@filter_chain)
|
168
168
|
filters = filter_chain.instance_variable_get(:@filters)
|
169
169
|
|
170
|
-
expect(filters.size).to eq(
|
170
|
+
expect(filters.size).to eq(3)
|
171
171
|
|
172
172
|
described_class.add_filter {}
|
173
173
|
|
174
|
-
expect(filters.size).to eq(
|
174
|
+
expect(filters.size).to eq(4)
|
175
175
|
expect(filters.last).to be_a(Proc)
|
176
176
|
end
|
177
177
|
end
|
data/spec/config_spec.rb
CHANGED
@@ -51,8 +51,8 @@ RSpec.describe Airbrake::Config do
|
|
51
51
|
expect(config.queue_size).to eq(100)
|
52
52
|
end
|
53
53
|
|
54
|
-
it "
|
55
|
-
expect(config.root_directory).to
|
54
|
+
it "sets the default root_directory" do
|
55
|
+
expect(config.root_directory).to eq Bundler.root
|
56
56
|
end
|
57
57
|
|
58
58
|
it "doesn't set the default environment" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airbrake Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|