denouncer 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -0
- data/denouncer.gemspec +1 -0
- data/lib/denouncer/notifiers.rb +1 -0
- data/lib/denouncer/notifiers/airbrake_notifier.rb +35 -0
- data/lib/denouncer/version.rb +1 -1
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ebc092428d54475eaad29ef95ee9fdf9693c7a6
|
4
|
+
data.tar.gz: c99262d3fb6d92b93170ac1c0002a3989462f39e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5d058c86ad2e9f8a8145deec9607538a88d081eb178ce1a87339d4f233c7c8511bce942aba2c487b21676dd07973e23270250d3891c0687e97af2eae2f39f6a
|
7
|
+
data.tar.gz: 1bff9e47c7b2efd3363d747f167589ae6cdf2c93c9c8e9736a8e1beb4d1e5353c8f4ccb96a5cfb1491cbba220645eae348f628ecb203d06ed840a53c34da10fa
|
data/README.md
CHANGED
@@ -141,6 +141,26 @@ Honeybadger is automatically configured using environment variables (e.g. HONEYB
|
|
141
141
|
notifier: :honeybadger
|
142
142
|
)
|
143
143
|
|
144
|
+
#### AirbrakeNotifier
|
145
|
+
|
146
|
+
For more information on airbrake please refer to their [github repo](https://github.com/airbrake/airbrake).
|
147
|
+
|
148
|
+
#### !!!ATTENTION
|
149
|
+
|
150
|
+
The airbrake gem is required for the AirbrakeNotifier. Please add the gem to your Gemfile as follows:
|
151
|
+
|
152
|
+
gem 'airbrake'
|
153
|
+
|
154
|
+
|
155
|
+
##### Airbrake Usage
|
156
|
+
|
157
|
+
require 'denouncer'
|
158
|
+
|
159
|
+
Denouncer.configure(
|
160
|
+
application_name: "my_app",
|
161
|
+
notifier: :airbrake,
|
162
|
+
api_key: 'my_key'
|
163
|
+
)
|
144
164
|
|
145
165
|
#### Multiple notifier configuration
|
146
166
|
|
@@ -210,3 +230,20 @@ The metadata is optional and defaults to nil.
|
|
210
230
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
211
231
|
4. Push to the branch (`git push origin my-new-feature`)
|
212
232
|
5. Create a new Pull Request
|
233
|
+
|
234
|
+
## How to add a new notfier?
|
235
|
+
|
236
|
+
# Copy the console notifier as base
|
237
|
+
cp lib/denouncer/notifiers/console_notifier.rb lib/denouncer/notifiers/<name>_notifier.rb
|
238
|
+
|
239
|
+
# add your notifier to the module
|
240
|
+
vim lib/denouncer/notifiers.rb
|
241
|
+
|
242
|
+
# adjust the notifier as needed
|
243
|
+
# implement name, set_configuration! and notify methods
|
244
|
+
vim lib/denouncer/notifiers/<name>_notifier.rb
|
245
|
+
|
246
|
+
# add a section for the notifier to the documentation
|
247
|
+
vim README.md
|
248
|
+
|
249
|
+
# follow the instructions above (Contributing)
|
data/denouncer.gemspec
CHANGED
data/lib/denouncer/notifiers.rb
CHANGED
@@ -5,5 +5,6 @@ module Denouncer
|
|
5
5
|
autoload :SmtpNotifier, File.expand_path('../notifiers/smtp_notifier', __FILE__)
|
6
6
|
autoload :AmqpNotifier, File.expand_path('../notifiers/amqp_notifier', __FILE__)
|
7
7
|
autoload :HoneybadgerNotifier, File.expand_path('../notifiers/honeybadger_notifier', __FILE__)
|
8
|
+
autoload :AirbrakeNotifier, File.expand_path('../notifiers/airbrake_notifier', __FILE__)
|
8
9
|
end
|
9
10
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'socket'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Denouncer
|
5
|
+
module Notifiers
|
6
|
+
class AirbrakeNotifier < BaseNotifier
|
7
|
+
|
8
|
+
# @return [String]
|
9
|
+
def name
|
10
|
+
'airbrake'
|
11
|
+
end
|
12
|
+
|
13
|
+
def set_configuration!(options)
|
14
|
+
raise "Airbrake configuration error: :api_key is nil!" if options[:api_key].nil?
|
15
|
+
require 'airbrake'
|
16
|
+
Airbrake.configure do |config|
|
17
|
+
config.api_key = options[:api_key]
|
18
|
+
end
|
19
|
+
return options
|
20
|
+
end
|
21
|
+
|
22
|
+
# Sends an error notification via amqp.
|
23
|
+
#
|
24
|
+
# @param error [StandardError]
|
25
|
+
# @param metadata [Hash]
|
26
|
+
def notify(error, metadata = nil)
|
27
|
+
Airbrake.notify(error,
|
28
|
+
api_key: config[:api_key],
|
29
|
+
error_message: error.message,
|
30
|
+
backtrace: error.backtrace
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/denouncer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: denouncer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Weber
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: airbrake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: Denouncer allows you to send notifications with error/exception details
|
126
140
|
using a simple interface. New methods of sending error messages can be implemented
|
127
141
|
using a pre-defined class interface. SMTP and AMQP notification are the first implemented
|
@@ -142,6 +156,7 @@ files:
|
|
142
156
|
- denouncer.gemspec
|
143
157
|
- lib/denouncer.rb
|
144
158
|
- lib/denouncer/notifiers.rb
|
159
|
+
- lib/denouncer/notifiers/airbrake_notifier.rb
|
145
160
|
- lib/denouncer/notifiers/amqp_notifier.rb
|
146
161
|
- lib/denouncer/notifiers/base_notifier.rb
|
147
162
|
- lib/denouncer/notifiers/console_notifier.rb
|