uniform_notifier 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/uniform_notifier.rb +7 -2
- data/lib/uniform_notifier/sentry.rb +21 -0
- data/lib/uniform_notifier/version.rb +1 -1
- data/spec/uniform_notifier/sentry_spec.rb +25 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daf1fcd71af2c468e1ba0fe5173fac2205bae8dd
|
4
|
+
data.tar.gz: c97aeac72e004d585fba564dc09fbc408d5af426
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23fe312e299e387bba4da21216ad2e0c5dd87e92c032fed14fb5fedd210c21c7a925be46cdfb7a1056609b4493fc17de29fa1c00c9581b970510f9780d8ffd30
|
7
|
+
data.tar.gz: 00446377e262d875c05f5fb78ec8086c9502559e908909243c965687f17abe7bd27f7b586b5a5ab6b17f6ba8038ceb42a1300b98c01d394941f87e2e634f1c65
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -87,7 +87,7 @@ By default, all notifiers are disabled, you should enable them first.
|
|
87
87
|
# slack
|
88
88
|
UniformNotifier.slack = true
|
89
89
|
# slack with options
|
90
|
-
UniformNotifier.slack = { :webhook_url => 'http://some.slack.url', :
|
90
|
+
UniformNotifier.slack = { :webhook_url => 'http://some.slack.url', :channel => '#default', :username => 'notifier' }
|
91
91
|
|
92
92
|
# customized logger
|
93
93
|
logger = File.open('notify.log', 'a+')
|
data/lib/uniform_notifier.rb
CHANGED
@@ -8,6 +8,7 @@ require 'uniform_notifier/xmpp'
|
|
8
8
|
require 'uniform_notifier/rails_logger'
|
9
9
|
require 'uniform_notifier/customized_logger'
|
10
10
|
require 'uniform_notifier/airbrake'
|
11
|
+
require 'uniform_notifier/sentry'
|
11
12
|
require 'uniform_notifier/rollbar'
|
12
13
|
require 'uniform_notifier/bugsnag'
|
13
14
|
require 'uniform_notifier/slack'
|
@@ -15,10 +16,14 @@ require 'uniform_notifier/raise'
|
|
15
16
|
|
16
17
|
class UniformNotifier
|
17
18
|
AVAILABLE_NOTIFIERS = [:alert, :console, :growl, :honeybadger, :xmpp, :rails_logger,
|
18
|
-
:customized_logger, :airbrake, :rollbar, :bugsnag, :slack, :raise
|
19
|
+
:customized_logger, :airbrake, :rollbar, :bugsnag, :slack, :raise,
|
20
|
+
:sentry
|
21
|
+
]
|
19
22
|
|
20
23
|
NOTIFIERS = [JavascriptAlert, JavascriptConsole, Growl, HoneybadgerNotifier, Xmpp, RailsLogger,
|
21
|
-
CustomizedLogger, AirbrakeNotifier, RollbarNotifier, BugsnagNotifier, Raise, Slack
|
24
|
+
CustomizedLogger, AirbrakeNotifier, RollbarNotifier, BugsnagNotifier, Raise, Slack,
|
25
|
+
SentryNotifier
|
26
|
+
]
|
22
27
|
|
23
28
|
class NotificationError < StandardError; end
|
24
29
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class UniformNotifier
|
2
|
+
class SentryNotifier < Base
|
3
|
+
def self.active?
|
4
|
+
!!UniformNotifier.sentry
|
5
|
+
end
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def self._out_of_channel_notify(data)
|
10
|
+
message = data.values.compact.join("\n")
|
11
|
+
|
12
|
+
opt = {}
|
13
|
+
if UniformNotifier.sentry.is_a?(Hash)
|
14
|
+
opt = UniformNotifier.sentry
|
15
|
+
end
|
16
|
+
|
17
|
+
exception = Exception.new(message)
|
18
|
+
Raven.capture_exception(exception, opt)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
class Raven
|
4
|
+
# mock Sentry
|
5
|
+
end
|
6
|
+
|
7
|
+
RSpec.describe UniformNotifier::SentryNotifier do
|
8
|
+
it "should not notify sentry" do
|
9
|
+
expect(UniformNotifier::SentryNotifier.out_of_channel_notify(:title => "notify sentry")).to be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should notify sentry" do
|
13
|
+
expect(Raven).to receive(:capture_exception).with(UniformNotifier::Exception.new("notify sentry"), {})
|
14
|
+
|
15
|
+
UniformNotifier.sentry = true
|
16
|
+
UniformNotifier::SentryNotifier.out_of_channel_notify(:title => "notify sentry")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should notify sentry" do
|
20
|
+
expect(Raven).to receive(:capture_exception).with(UniformNotifier::Exception.new("notify sentry"), :foo => :bar)
|
21
|
+
|
22
|
+
UniformNotifier.sentry = { :foo => :bar }
|
23
|
+
UniformNotifier::SentryNotifier.out_of_channel_notify("notify sentry")
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniform_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-growl
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- lib/uniform_notifier/rails_logger.rb
|
109
109
|
- lib/uniform_notifier/raise.rb
|
110
110
|
- lib/uniform_notifier/rollbar.rb
|
111
|
+
- lib/uniform_notifier/sentry.rb
|
111
112
|
- lib/uniform_notifier/slack.rb
|
112
113
|
- lib/uniform_notifier/version.rb
|
113
114
|
- lib/uniform_notifier/xmpp.rb
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- spec/uniform_notifier/rails_logger_spec.rb
|
124
125
|
- spec/uniform_notifier/raise_spec.rb
|
125
126
|
- spec/uniform_notifier/rollbar_spec.rb
|
127
|
+
- spec/uniform_notifier/sentry_spec.rb
|
126
128
|
- spec/uniform_notifier/slack_spec.rb
|
127
129
|
- spec/uniform_notifier/xmpp_spec.rb
|
128
130
|
- uniform_notifier.gemspec
|
@@ -146,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
148
|
version: '0'
|
147
149
|
requirements: []
|
148
150
|
rubyforge_project: uniform_notifier
|
149
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.6.13
|
150
152
|
signing_key:
|
151
153
|
specification_version: 4
|
152
154
|
summary: uniform notifier for rails logger, customized logger, javascript alert, javascript
|
@@ -164,5 +166,6 @@ test_files:
|
|
164
166
|
- spec/uniform_notifier/rails_logger_spec.rb
|
165
167
|
- spec/uniform_notifier/raise_spec.rb
|
166
168
|
- spec/uniform_notifier/rollbar_spec.rb
|
169
|
+
- spec/uniform_notifier/sentry_spec.rb
|
167
170
|
- spec/uniform_notifier/slack_spec.rb
|
168
171
|
- spec/uniform_notifier/xmpp_spec.rb
|