uniform_notifier 1.10.0 → 1.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce5c6778339ac98c3683322370c55b36e2e0f6d8
4
- data.tar.gz: 2c10528a49539b46b7cdfbde658d5032e04ccffb
3
+ metadata.gz: daf1fcd71af2c468e1ba0fe5173fac2205bae8dd
4
+ data.tar.gz: c97aeac72e004d585fba564dc09fbc408d5af426
5
5
  SHA512:
6
- metadata.gz: bdff272e464293c384f81eb736b0e1d639293ae84b97c3212cff43f8ea5e150f43095f5f4efd055c57c50eb9be4e9d664d75efcf4b3d07d16083b058cf65e335
7
- data.tar.gz: 0918ca02b1d871578e5cd5c45bb0037553ef7739adcbdd73d4655dad8d796290a0890e38de0fe1168c57af2dce392d458ab998507141a3ed46ed1c1cdea466a4
6
+ metadata.gz: 23fe312e299e387bba4da21216ad2e0c5dd87e92c032fed14fb5fedd210c21c7a925be46cdfb7a1056609b4493fc17de29fa1c00c9581b970510f9780d8ffd30
7
+ data.tar.gz: 00446377e262d875c05f5fb78ec8086c9502559e908909243c965687f17abe7bd27f7b586b5a5ab6b17f6ba8038ceb42a1300b98c01d394941f87e2e634f1c65
@@ -1,5 +1,9 @@
1
1
  # Next Release
2
2
 
3
+ ## 1.11.0 (13/11/2017)
4
+
5
+ * Add Sentry notifier
6
+
3
7
  ## 1.10.0 (01/06/2016)
4
8
 
5
9
  * Add honeybadger notifier
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', :foo => 'bar' }
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+')
@@ -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
@@ -1,3 +1,3 @@
1
1
  class UniformNotifier
2
- VERSION = "1.10.0"
2
+ VERSION = "1.11.0"
3
3
  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.10.0
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: 2016-01-06 00:00:00.000000000 Z
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.5.1
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