uniform_notifier 1.15.0 → 1.17.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
  SHA256:
3
- metadata.gz: 8cbfb1cbe32444a41960c0a9671bac48a43d96722312c1717c0c4e7a2a804433
4
- data.tar.gz: 6c82f5aa72805717af977bc454464eaaf6cf2222e96cf6b97581265eb52ec678
3
+ metadata.gz: d641654b7aff4ab4206fd82919704ed0c0ec1046b89ce57f30d886b28b52a8b1
4
+ data.tar.gz: 9b6b94fe108c905bb43386f22fd7882a1b8aac22f36e6f46c1e8da70923bdbc6
5
5
  SHA512:
6
- metadata.gz: 6870a31994f2d3592c30f145c76efedb4cb773053231732d4a2e369ced6ff013f37c673df7279d90bd4067dfd6029073b55fc24b957936519033abae809aef94
7
- data.tar.gz: '09a5bb04b7966baf30a5af2b207dd7e33c2450e8058ebf16efe23ce7f024f3330e49ceaf07b3c1571fb0b316e1fffa1ce62673431f2145ac2762fe2b55e19b16'
6
+ metadata.gz: 156cef00e47ac3bedb24a6a81c16c6567b9ce4fcdb101e0651347244a71b4a0cc1f66d6821af6649540edffdbb92511bbe497ad5216f74e8f737ebb8afcd7ddc
7
+ data.tar.gz: dcb2bbe6a3f977ac76c74b280a6a773440a8d367141df4466996a40bf72e94547a0fb29063d7676b89d4cf341cf5310cdb307953e0046c806dcf5161d1405ca0
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ ruby:
14
+ - 2.7
15
+ - 3.0
16
+ - 3.1
17
+ - 3.2
18
+ - 3.3
19
+ steps:
20
+ - name: Checkout code
21
+ uses: actions/checkout@v3
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ bundler-cache: true
27
+ - name: Run tests
28
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,19 +1,28 @@
1
1
  # Next Release
2
2
 
3
- # 1.15.0 (03/21/2022)
3
+ ## 1.17.0 (05/07/2025)
4
+
5
+ * Introduce opentelemetry notifier
6
+
7
+ ## 1.16.0 (03/24/2022)
8
+
9
+ * Drop Growl support
10
+ * Move CI from travis to github actions
11
+
12
+ ## 1.15.0 (03/21/2022)
4
13
 
5
14
  * Fix bugsnag notifications
6
15
  * Improve appsignal message
7
16
 
8
- # 1.14.2 (03/24/2021)
17
+ ## 1.14.2 (03/24/2021)
9
18
 
10
19
  * Fix `capture_exception` signature
11
20
 
12
- # 1.14.1 (02/28/2021)
21
+ ## 1.14.1 (02/28/2021)
13
22
 
14
23
  * Fix uninitialized constant ``UniformNotifier::SentryNotifier::Raven`` error
15
24
 
16
- # 1.14.0 (02/26/2021)
25
+ ## 1.14.0 (02/26/2021)
17
26
 
18
27
  * Add AppSignal integration
19
28
  * Fix `UniformNotifier::Raise.active?` when `.rails=` receives a false value
data/Gemfile CHANGED
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'http://rubygems.org'
3
+ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in uniform_notifier.gemspec
6
6
  gemspec
7
7
 
8
8
  gem 'rake'
9
+ gem 'rexml' # for Ruby 3.0+
data/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  # UniformNotifier
2
2
 
3
- [![Build
4
- Status](https://secure.travis-ci.org/flyerhzm/uniform_notifier.svg)](http://travis-ci.org/flyerhzm/uniform_notifier)
3
+ [![CI](https://github.com/flyerhzm/uniform_notifier/actions/workflows/ci.yml/badge.svg)](https://github.com/flyerhzm/uniform_notifier/actions/workflows/ci.yml)
5
4
  [![AwesomeCode Status for flyerhzm/uniform_notifier](https://awesomecode.io/projects/3e29a7de-0b37-4ecf-b06d-410ebf815174/status)](https://awesomecode.io/repos/flyerhzm/uniform_notifier)
6
5
 
7
- uniform_notifier is extracted from [bullet][0], it gives you the ability to send notification through rails logger, customized logger, javascript alert, javascript console, growl, xmpp, airbrake, honeybadger and AppSignal.
6
+ uniform_notifier is extracted from [bullet][0], it gives you the ability to send notification through rails logger, customized logger, javascript alert, javascript console, xmpp, airbrake, honeybadger and AppSignal.
8
7
 
9
8
  ## Install
10
9
 
@@ -12,14 +11,6 @@ uniform_notifier is extracted from [bullet][0], it gives you the ability to send
12
11
 
13
12
  gem install uniform_notifier
14
13
 
15
- if you want to notify by growl < v1.3, you should install ruby-growl first
16
-
17
- gem install ruby-growl
18
-
19
- if you want to notify by growl v1.3+, you should install ruby_gntp first
20
-
21
- gem install ruby_gntp
22
-
23
14
  if you want to notify by xmpp, you should install xmpp4r first
24
15
 
25
16
  gem install xmpp4r
@@ -56,13 +47,13 @@ if you want to notify by terminal-notifier, you must install it first
56
47
 
57
48
  gem "uniform_notifier"
58
49
 
59
- you should add ruby-growl, ruby_gntp, xmpp4r, airbrake, bugsnag, honeybadger, slack-notifier, terminal-notifier gem if you want.
50
+ you should add xmpp4r, airbrake, bugsnag, honeybadger, slack-notifier, terminal-notifier gem if you want.
60
51
 
61
52
  ## Usage
62
53
 
63
54
  There are two types of notifications,
64
55
  one is <code>inline_notify</code>, for javascript alert and javascript console notifiers, which returns a string and will be combined,
65
- the other is <code>out_of_channel_notify</code>, for rails logger, customized logger, growl and xmpp, which doesn't return anything, just send the message to the notifiers.
56
+ the other is <code>out_of_channel_notify</code>, for rails logger, customized logger, xmpp, which doesn't return anything, just send the message to the notifiers.
66
57
 
67
58
  By default, all notifiers are disabled, you should enable them first.
68
59
 
@@ -120,11 +111,6 @@ logger = File.open('notify.log', 'a+')
120
111
  logger.sync = true
121
112
  UniformNotifier.customized_logger = logger
122
113
 
123
- # growl without password
124
- UniformNotifier.growl = true
125
- # growl with passowrd
126
- UniformNotifier.growl = { :password => 'growl password' }
127
-
128
114
  # xmpp
129
115
  UniformNotifier.xmpp = { :account => 'sender_account@jabber.org',
130
116
  :password => 'password_for_jabber',
@@ -146,7 +132,7 @@ UniformNotifier.raise = false # don't raise errors
146
132
  After that, you can enjoy the notifiers, that's cool!
147
133
 
148
134
  ```ruby
149
- # the notify message will be notified to rails logger, customized logger, growl or xmpp.
135
+ # the notify message will be notified to rails logger, customized logger or xmpp.
150
136
  UniformNotifier.active_notifiers.each do |notifier|
151
137
  notifier.out_of_channel_notify("customize message")
152
138
  end
@@ -161,18 +147,6 @@ end
161
147
  javascript_str = responses.join("\n")
162
148
  ```
163
149
 
164
- ## Growl Support
165
-
166
- To get Growl support up-and-running, follow the steps below:
167
-
168
- * For Growl < v1.3, install the ruby-growl gem: <code>gem install ruby-growl</code>
169
- * For Growl v1.3+, install the ruby_gntp gem: <code>gem install ruby_gntp</code>
170
- * Open the Growl preference pane in Systems Preferences
171
- * Click the "Network" tab
172
- * Make sure both "Listen for incoming notifications" and "Allow remote application registration" are checked. *Note*: If you set a password, you will need to set <code>UniformNotifier.growl_password = { :password => 'growl password' }</code> in the config file.
173
- * Restart Growl ("General" tab -> Stop Growl -> Start Growl)
174
- * Boot up your application. UniformNotifier will automatically send a Growl notification when Growl is turned on. If you do not see it when your application loads, make sure it is enabled in your initializer and double-check the steps above.
175
-
176
150
  ## XMPP/Jabber Support
177
151
 
178
152
  To get XMPP support up-and-running, follow the steps below:
@@ -33,7 +33,8 @@ class UniformNotifier
33
33
 
34
34
  def wrap_js_association(code, attributes = {})
35
35
  attributes = { type: 'text/javascript' }.merge(attributes || {})
36
- attributes_string = attributes.map { |k, v| "#{k}=#{v.to_s.inspect}" }.join(' ')
36
+ attributes_string = attributes.map { |k, v| "#{k}=#{v.to_s.inspect}" }
37
+ .join(' ')
37
38
 
38
39
  <<~CODE
39
40
  <script #{attributes_string}>/*<![CDATA[*/
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UniformNotifier
4
+ class OpenTelemetryNotifier < Base
5
+ class << self
6
+ def active?
7
+ !!UniformNotifier.opentelemetry
8
+ end
9
+
10
+ protected
11
+
12
+ def _out_of_channel_notify(data)
13
+ message = data.values.compact.join("\n")
14
+
15
+ exception = Exception.new(message)
16
+ current_span = OpenTelemetry::Trace.current_span
17
+ current_span.record_exception(exception)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class UniformNotifier
4
- VERSION = '1.15.0'
4
+ VERSION = '1.17.0'
5
5
  end
@@ -4,7 +4,6 @@ require 'uniform_notifier/base'
4
4
  require 'uniform_notifier/errors'
5
5
  require 'uniform_notifier/javascript_alert'
6
6
  require 'uniform_notifier/javascript_console'
7
- require 'uniform_notifier/growl'
8
7
  require 'uniform_notifier/honeybadger'
9
8
  require 'uniform_notifier/xmpp'
10
9
  require 'uniform_notifier/rails_logger'
@@ -17,12 +16,12 @@ require 'uniform_notifier/appsignal'
17
16
  require 'uniform_notifier/slack'
18
17
  require 'uniform_notifier/raise'
19
18
  require 'uniform_notifier/terminal_notifier'
19
+ require 'uniform_notifier/opentelemetry'
20
20
 
21
21
  class UniformNotifier
22
22
  AVAILABLE_NOTIFIERS = %i[
23
23
  alert
24
24
  console
25
- growl
26
25
  honeybadger
27
26
  xmpp
28
27
  rails_logger
@@ -35,12 +34,12 @@ class UniformNotifier
35
34
  sentry
36
35
  appsignal
37
36
  terminal_notifier
37
+ opentelemetry
38
38
  ].freeze
39
39
 
40
40
  NOTIFIERS = [
41
41
  JavascriptAlert,
42
42
  JavascriptConsole,
43
- Growl,
44
43
  HoneybadgerNotifier,
45
44
  Xmpp,
46
45
  RailsLogger,
@@ -52,7 +51,8 @@ class UniformNotifier
52
51
  Slack,
53
52
  SentryNotifier,
54
53
  AppsignalNotifier,
55
- TerminalNotifier
54
+ TerminalNotifier,
55
+ OpenTelemetryNotifier
56
56
  ].freeze
57
57
 
58
58
  class NotificationError < StandardError
@@ -65,11 +65,6 @@ class UniformNotifier
65
65
  NOTIFIERS.select(&:active?)
66
66
  end
67
67
 
68
- undef growl=
69
- def growl=(growl)
70
- UniformNotifier::Growl.setup_connection(growl)
71
- end
72
-
73
68
  undef xmpp=
74
69
  def xmpp=(xmpp)
75
70
  UniformNotifier::Xmpp.setup_connection(xmpp)
data/spec/spec_helper.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
 
5
5
  require 'uniform_notifier'
6
- require 'ruby-growl'
7
6
  require 'xmpp4r'
8
7
  require 'slack-notifier'
9
8
  require 'rspec'
@@ -19,7 +19,7 @@ RSpec.describe UniformNotifier::AirbrakeNotifier do
19
19
  end
20
20
 
21
21
  it 'should notify airbrake' do
22
- expect(Airbrake).to receive(:notify).with(UniformNotifier::Exception.new('notify airbrake'), foo: :bar)
22
+ expect(Airbrake).to receive(:notify).with(UniformNotifier::Exception.new('notify airbrake'), { foo: :bar })
23
23
 
24
24
  UniformNotifier.airbrake = { foo: :bar }
25
25
  UniformNotifier::AirbrakeNotifier.out_of_channel_notify('notify airbrake')
@@ -6,14 +6,14 @@ RSpec.describe UniformNotifier::Base do
6
6
  context '#inline_channel_notify' do
7
7
  before { allow(UniformNotifier::Base).to receive(:active?).and_return(true) }
8
8
  it 'should keep the compatibility' do
9
- expect(UniformNotifier::Base).to receive(:_inline_notify).once.with(title: 'something')
9
+ expect(UniformNotifier::Base).to receive(:_inline_notify).once.with({ title: 'something' })
10
10
  UniformNotifier::Base.inline_notify('something')
11
11
  end
12
12
  end
13
13
  context '#out_of_channel_notify' do
14
14
  before { allow(UniformNotifier::Base).to receive(:active?).and_return(true) }
15
15
  it 'should keep the compatibility' do
16
- expect(UniformNotifier::Base).to receive(:_out_of_channel_notify).once.with(title: 'something')
16
+ expect(UniformNotifier::Base).to receive(:_out_of_channel_notify).once.with({ title: 'something' })
17
17
  UniformNotifier::Base.out_of_channel_notify('something')
18
18
  end
19
19
  end
@@ -22,11 +22,9 @@ RSpec.describe UniformNotifier::BugsnagNotifier do
22
22
  let(:notification_data) { 'notify bugsnag' }
23
23
 
24
24
  it 'should notify bugsnag' do
25
- expect(Bugsnag).to receive(:notify).with(
26
- UniformNotifier::Exception.new(notification_data)
27
- ).and_yield(report)
25
+ expect(Bugsnag).to receive(:notify).with(UniformNotifier::Exception.new(notification_data)).and_yield(report)
28
26
  expect(report).to receive(:severity=).with('warning')
29
- expect(report).to receive(:add_tab).with(:bullet, title: notification_data)
27
+ expect(report).to receive(:add_tab).with(:bullet, { title: notification_data })
30
28
  expect(report).to receive(:grouping_hash=).with(notification_data)
31
29
 
32
30
  UniformNotifier.bugsnag = true
@@ -34,10 +32,8 @@ RSpec.describe UniformNotifier::BugsnagNotifier do
34
32
  end
35
33
 
36
34
  it 'should notify bugsnag with additional report configuration' do
37
- expect(Bugsnag).to receive(:notify).with(
38
- UniformNotifier::Exception.new(notification_data)
39
- ).and_yield(report)
40
- expect(report).to receive(:meta_data=).with(foo: :bar)
35
+ expect(Bugsnag).to receive(:notify).with(UniformNotifier::Exception.new(notification_data)).and_yield(report)
36
+ expect(report).to receive(:meta_data=).with({ foo: :bar })
41
37
 
42
38
  UniformNotifier.bugsnag = ->(report) { report.meta_data = { foo: :bar } }
43
39
  UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
@@ -62,7 +58,7 @@ RSpec.describe UniformNotifier::BugsnagNotifier do
62
58
  expect(Bugsnag).to receive(:notify).with(
63
59
  UniformNotifier::Exception.new(notification_data[:title])
64
60
  ).and_yield(report)
65
- expect(report).to receive(:meta_data=).with(foo: :bar)
61
+ expect(report).to receive(:meta_data=).with({ foo: :bar })
66
62
 
67
63
  UniformNotifier.bugsnag = ->(report) { report.meta_data = { foo: :bar } }
68
64
  UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
@@ -19,7 +19,7 @@ RSpec.describe UniformNotifier::HoneybadgerNotifier do
19
19
  end
20
20
 
21
21
  it 'should notify honeybadger' do
22
- expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new('notify honeybadger'), foo: :bar)
22
+ expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new('notify honeybadger'), { foo: :bar })
23
23
 
24
24
  UniformNotifier.honeybadger = { foo: :bar }
25
25
  UniformNotifier::HoneybadgerNotifier.out_of_channel_notify('notify honeybadger')
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ class OpenTelemetry
6
+ class Trace
7
+ # mock OpenTelemetry
8
+ end
9
+ end
10
+
11
+ RSpec.describe UniformNotifier::OpenTelemetryNotifier do
12
+ it 'should not notify OpenTelemetry' do
13
+ expect(UniformNotifier::OpenTelemetryNotifier.out_of_channel_notify(title: 'notify otel')).to be_nil
14
+ end
15
+
16
+ it 'should notify OpenTelemetry' do
17
+ span = double('span')
18
+ expect(span).to receive(:record_exception).with(UniformNotifier::Exception.new('notify otel'))
19
+ expect(OpenTelemetry::Trace).to receive(:current_span).and_return(span)
20
+
21
+ UniformNotifier.opentelemetry = true
22
+ UniformNotifier::OpenTelemetryNotifier.out_of_channel_notify(title: 'notify otel')
23
+ end
24
+
25
+ it 'should notify OpenTelemetry' do
26
+ span = double('span')
27
+ expect(span).to receive(:record_exception).with(UniformNotifier::Exception.new('notify otel'))
28
+ expect(OpenTelemetry::Trace).to receive(:current_span).and_return(span)
29
+
30
+ UniformNotifier.opentelemetry = { foo: :bar }
31
+ UniformNotifier::OpenTelemetryNotifier.out_of_channel_notify('notify otel')
32
+ end
33
+ end
@@ -9,22 +9,25 @@ RSpec.describe UniformNotifier::Raise do
9
9
 
10
10
  it 'should raise error of the default class' do
11
11
  UniformNotifier.raise = true
12
- expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }.to raise_error(
13
- UniformNotifier::Exception,
14
- 'notification'
15
- )
12
+ expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
13
+ .to raise_error(
14
+ UniformNotifier::Exception,
15
+ 'notification'
16
+ )
16
17
  end
17
18
 
18
19
  it 'allows the user to override the default exception class' do
19
20
  klass = Class.new(RuntimeError)
20
21
  UniformNotifier.raise = klass
21
- expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }.to raise_error(klass, 'notification')
22
+ expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
23
+ .to raise_error(klass, 'notification')
22
24
  end
23
25
 
24
26
  it 'can be turned from on to off again' do
25
27
  UniformNotifier.raise = true
26
28
  UniformNotifier.raise = false
27
29
 
28
- expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }.not_to raise_error
30
+ expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
31
+ .not_to raise_error
29
32
  end
30
33
  end
@@ -13,7 +13,8 @@ RSpec.describe UniformNotifier::Slack do
13
13
  context 'configuration' do
14
14
  context 'no webhook_url is given' do
15
15
  it 'should raise an error' do
16
- expect { UniformNotifier.slack = {} }.to raise_error(UniformNotifier::NotificationError)
16
+ expect { UniformNotifier.slack = {} }
17
+ .to raise_error(UniformNotifier::NotificationError)
17
18
  end
18
19
 
19
20
  it 'should not notify slack' do
@@ -35,7 +36,7 @@ RSpec.describe UniformNotifier::Slack do
35
36
 
36
37
  it 'should allow username and channel config options' do
37
38
  expect(Slack::Notifier).to receive(:new)
38
- .with('http://some.slack.url', username: 'The Dude', channel: '#carpets')
39
+ .with('http://some.slack.url', { username: 'The Dude', channel: '#carpets' })
39
40
  .and_return(true)
40
41
  UniformNotifier.slack = { webhook_url: 'http://some.slack.url', username: 'The Dude', channel: '#carpets' }
41
42
  expect(UniformNotifier::Slack.active?).to eq true
@@ -10,15 +10,13 @@ Gem::Specification.new do |s|
10
10
  s.authors = ['Richard Huang']
11
11
  s.email = ['flyerhzm@gmail.com']
12
12
  s.homepage = 'http://rubygems.org/gems/uniform_notifier'
13
- s.summary = 'uniform notifier for rails logger, customized logger, javascript alert, javascript console, growl and xmpp'
14
- s.description = 'uniform notifier for rails logger, customized logger, javascript alert, javascript console, growl and xmpp'
13
+ s.summary = 'uniform notifier for rails logger, customized logger, javascript alert, javascript console and xmpp'
14
+ s.description = 'uniform notifier for rails logger, customized logger, javascript alert, javascript console and xmpp'
15
15
  s.license = 'MIT'
16
16
 
17
17
  s.required_ruby_version = '>= 2.3'
18
18
 
19
19
  s.add_development_dependency 'rspec', ['> 0']
20
- s.add_development_dependency 'ruby_gntp', ['= 0.3.4']
21
- s.add_development_dependency 'ruby-growl', ['= 4.0']
22
20
  s.add_development_dependency 'slack-notifier', ['>= 1.0']
23
21
  s.add_development_dependency 'xmpp4r', ['= 0.5']
24
22
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uniform_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.0
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-03-21 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rspec
@@ -24,34 +23,6 @@ dependencies:
24
23
  - - ">"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: ruby_gntp
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 0.3.4
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 0.3.4
41
- - !ruby/object:Gem::Dependency
42
- name: ruby-growl
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: '4.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: '4.0'
55
26
  - !ruby/object:Gem::Dependency
56
27
  name: slack-notifier
57
28
  requirement: !ruby/object:Gem::Requirement
@@ -81,15 +52,15 @@ dependencies:
81
52
  - !ruby/object:Gem::Version
82
53
  version: '0.5'
83
54
  description: uniform notifier for rails logger, customized logger, javascript alert,
84
- javascript console, growl and xmpp
55
+ javascript console and xmpp
85
56
  email:
86
57
  - flyerhzm@gmail.com
87
58
  executables: []
88
59
  extensions: []
89
60
  extra_rdoc_files: []
90
61
  files:
62
+ - ".github/workflows/ci.yml"
91
63
  - ".gitignore"
92
- - ".travis.yml"
93
64
  - CHANGELOG.md
94
65
  - Gemfile
95
66
  - LICENSE
@@ -102,10 +73,10 @@ files:
102
73
  - lib/uniform_notifier/bugsnag.rb
103
74
  - lib/uniform_notifier/customized_logger.rb
104
75
  - lib/uniform_notifier/errors.rb
105
- - lib/uniform_notifier/growl.rb
106
76
  - lib/uniform_notifier/honeybadger.rb
107
77
  - lib/uniform_notifier/javascript_alert.rb
108
78
  - lib/uniform_notifier/javascript_console.rb
79
+ - lib/uniform_notifier/opentelemetry.rb
109
80
  - lib/uniform_notifier/rails_logger.rb
110
81
  - lib/uniform_notifier/raise.rb
111
82
  - lib/uniform_notifier/rollbar.rb
@@ -120,10 +91,10 @@ files:
120
91
  - spec/uniform_notifier/base_spec.rb
121
92
  - spec/uniform_notifier/bugsnag_spec.rb
122
93
  - spec/uniform_notifier/customized_logger_spec.rb
123
- - spec/uniform_notifier/growl_spec.rb
124
94
  - spec/uniform_notifier/honeybadger_spec.rb
125
95
  - spec/uniform_notifier/javascript_alert_spec.rb
126
96
  - spec/uniform_notifier/javascript_console_spec.rb
97
+ - spec/uniform_notifier/opentelemetry_spec.rb
127
98
  - spec/uniform_notifier/rails_logger_spec.rb
128
99
  - spec/uniform_notifier/raise_spec.rb
129
100
  - spec/uniform_notifier/rollbar_spec.rb
@@ -139,7 +110,6 @@ metadata:
139
110
  changelog_uri: https://github.com/flyerhzm/uniform_notifier/blob/master/CHANGELOG.md
140
111
  source_code_uri: https://github.com/flyerhzm/uniform_notifier
141
112
  bug_tracker_uri: https://github.com/flyerhzm/uniform_notifier/issues
142
- post_install_message:
143
113
  rdoc_options: []
144
114
  require_paths:
145
115
  - lib
@@ -154,11 +124,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
124
  - !ruby/object:Gem::Version
155
125
  version: '0'
156
126
  requirements: []
157
- rubygems_version: 3.3.7
158
- signing_key:
127
+ rubygems_version: 3.6.7
159
128
  specification_version: 4
160
129
  summary: uniform notifier for rails logger, customized logger, javascript alert, javascript
161
- console, growl and xmpp
130
+ console and xmpp
162
131
  test_files:
163
132
  - spec/spec_helper.rb
164
133
  - spec/uniform_notifier/airbrake_spec.rb
@@ -166,10 +135,10 @@ test_files:
166
135
  - spec/uniform_notifier/base_spec.rb
167
136
  - spec/uniform_notifier/bugsnag_spec.rb
168
137
  - spec/uniform_notifier/customized_logger_spec.rb
169
- - spec/uniform_notifier/growl_spec.rb
170
138
  - spec/uniform_notifier/honeybadger_spec.rb
171
139
  - spec/uniform_notifier/javascript_alert_spec.rb
172
140
  - spec/uniform_notifier/javascript_console_spec.rb
141
+ - spec/uniform_notifier/opentelemetry_spec.rb
173
142
  - spec/uniform_notifier/rails_logger_spec.rb
174
143
  - spec/uniform_notifier/raise_spec.rb
175
144
  - spec/uniform_notifier/rollbar_spec.rb
data/.travis.yml DELETED
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.7.2
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class UniformNotifier
4
- class Growl < Base
5
- class << self
6
- @growl = nil
7
-
8
- def active?
9
- @growl
10
- end
11
-
12
- def setup_connection(growl)
13
- setup_connection_growl(growl)
14
- rescue LoadError
15
- begin
16
- setup_connection_gntp(growl)
17
- rescue LoadError
18
- @growl = nil
19
- raise NotificationError,
20
- 'You must install the ruby-growl or the ruby_gntp gem to use Growl notification: `gem install ruby-growl` or `gem install ruby_gntp`'
21
- end
22
- end
23
-
24
- def setup_connection_growl(growl)
25
- return unless growl
26
-
27
- require 'ruby-growl'
28
- if growl.instance_of?(Hash)
29
- @password = growl.include?(:password) ? growl[:password] : nil
30
- @host = growl.include?(:host) ? growl[:host] : 'localhost'
31
- end
32
- @password ||= nil
33
- @host ||= 'localhost'
34
- @growl = ::Growl.new @host, 'uniform_notifier'
35
- @growl.add_notification 'uniform_notifier'
36
- @growl.password = @password
37
-
38
- notify 'Uniform Notifier Growl has been turned on' if !growl.instance_of?(Hash) || !growl[:quiet]
39
- end
40
-
41
- def setup_connection_gntp(growl)
42
- return unless growl
43
-
44
- require 'ruby_gntp'
45
- if growl.instance_of?(Hash)
46
- @password = growl.include?(:password) ? growl[:password] : nil
47
- @host = growl.include?(:host) ? growl[:host] : 'localhost'
48
- end
49
- @password ||= nil
50
- @host ||= 'localhost'
51
- @growl = GNTP.new('uniform_notifier', @host, @password, 23_053)
52
- @growl.register(notifications: [{ name: 'uniform_notifier', enabled: true }])
53
-
54
- notify 'Uniform Notifier Growl has been turned on (using GNTP)' if !growl.instance_of?(Hash) || !growl[:quiet]
55
- end
56
-
57
- protected
58
-
59
- def _out_of_channel_notify(data)
60
- message = data.values.compact.join("\n")
61
-
62
- notify(message)
63
- end
64
-
65
- private
66
-
67
- def notify(message)
68
- if defined?(::Growl) && @growl.is_a?(::Growl)
69
- @growl.notify('uniform_notifier', 'Uniform Notifier', message)
70
- elsif defined?(::GNTP) && @growl.is_a?(::GNTP)
71
- @growl.notify(name: 'uniform_notifier', title: 'Uniform Notifier', text: message)
72
- end
73
- end
74
- end
75
- end
76
- end
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe UniformNotifier::Growl do
6
- it 'should not notify growl' do
7
- expect(UniformNotifier::Growl.out_of_channel_notify(title: 'notify growl')).to be_nil
8
- end
9
-
10
- it 'should notify growl without password' do
11
- growl = double('growl', is_a?: true)
12
- expect(Growl).to receive(:new).with('localhost', 'uniform_notifier').and_return(growl)
13
- expect(growl).to receive(:add_notification).with('uniform_notifier')
14
- expect(growl).to receive(:password=).with(nil)
15
- expect(growl).to receive(:notify)
16
- .with('uniform_notifier', 'Uniform Notifier', 'Uniform Notifier Growl has been turned on')
17
- .ordered
18
- expect(growl).to receive(:notify)
19
- .with('uniform_notifier', 'Uniform Notifier', 'notify growl without password')
20
- .ordered
21
-
22
- UniformNotifier.growl = true
23
- UniformNotifier::Growl.out_of_channel_notify(title: 'notify growl without password')
24
- end
25
-
26
- it 'should notify growl with password' do
27
- growl = double('growl', is_a?: true)
28
- expect(Growl).to receive(:new).with('localhost', 'uniform_notifier').and_return(growl)
29
- expect(growl).to receive(:add_notification).with('uniform_notifier')
30
- expect(growl).to receive(:password=).with('123456')
31
- expect(growl).to receive(:notify)
32
- .with('uniform_notifier', 'Uniform Notifier', 'Uniform Notifier Growl has been turned on')
33
- .ordered
34
- expect(growl).to receive(:notify).with('uniform_notifier', 'Uniform Notifier', 'notify growl with password').ordered
35
-
36
- UniformNotifier.growl = { password: '123456' }
37
- UniformNotifier::Growl.out_of_channel_notify(title: 'notify growl with password')
38
- end
39
-
40
- it 'should notify growl with host' do
41
- growl = double('growl', is_a?: true)
42
- expect(Growl).to receive(:new).with('10.10.156.17', 'uniform_notifier').and_return(growl)
43
- expect(growl).to receive(:add_notification).with('uniform_notifier')
44
- expect(growl).to receive(:password=).with('123456')
45
- expect(growl).to receive(:notify)
46
- .with('uniform_notifier', 'Uniform Notifier', 'Uniform Notifier Growl has been turned on')
47
- .ordered
48
- expect(growl).to receive(:notify).with('uniform_notifier', 'Uniform Notifier', 'notify growl with password').ordered
49
-
50
- UniformNotifier.growl = { password: '123456', host: '10.10.156.17' }
51
- UniformNotifier::Growl.out_of_channel_notify(title: 'notify growl with password')
52
- end
53
-
54
- it 'should notify growl with quiet' do
55
- growl = double('growl', is_a?: true)
56
- expect(Growl).to receive(:new).with('localhost', 'uniform_notifier').and_return(growl)
57
- expect(growl).to receive(:add_notification).with('uniform_notifier')
58
- expect(growl).to receive(:password=).with('123456')
59
- expect(growl).not_to receive(:notify).with(
60
- 'uniform_notifier',
61
- 'Uniform Notifier',
62
- 'Uniform Notifier Growl has been turned on'
63
- )
64
- expect(growl).to receive(:notify).with('uniform_notifier', 'Uniform Notifier', 'notify growl with password')
65
-
66
- UniformNotifier.growl = { password: '123456', quiet: true }
67
- UniformNotifier::Growl.out_of_channel_notify(title: 'notify growl with password')
68
- end
69
- end