uniform_notifier 1.12.0 → 1.12.1
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/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +85 -81
- data/lib/uniform_notifier/bugsnag.rb +1 -3
- data/lib/uniform_notifier/sentry.rb +1 -3
- data/lib/uniform_notifier/version.rb +1 -1
- data/uniform_notifier.gemspec +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2277163be0ebc305f1d6b19d7fa21cfcd001495f
|
4
|
+
data.tar.gz: 936dd7c4dca648ed7455e31fee864300c5b451c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aed28aa21ea0317abeb16cdd224b07a59e2d236324de028eea148184e6fa2225885c39816a84a61be3b0245e4be1d8db464599fe8203d253ff36dbd820c591c7
|
7
|
+
data.tar.gz: d9356571f31ccbc28ab7fd7fef5f27e7e7dc2783faf6cbb1888cc7e3ce9e20d60dfe212324d429a9119c6143cd1752a40b82b325fc37788f1bdf50890040b527
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](http://travis-ci.org/flyerhzm/uniform_notifier)
|
5
|
-
[](https://awesomecode.io/
|
5
|
+
[](https://awesomecode.io/repos/flyerhzm/uniform_notifier)
|
6
6
|
|
7
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 and honeybadger.
|
8
8
|
|
@@ -62,89 +62,93 @@ the other is <code>out_of_channel_notify</code>, for rails logger, customized lo
|
|
62
62
|
|
63
63
|
By default, all notifiers are disabled, you should enable them first.
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
65
|
+
```ruby
|
66
|
+
# javascript alert
|
67
|
+
UniformNotifier.alert = true
|
68
|
+
# javascript alert with options
|
69
|
+
# the attributes key adds custom attributes to the script tag appended to the body
|
70
|
+
UniformNotifier.alert = { :attributes => { :nonce => 'mySecret-nonce', 'data-key' => 'value' } }
|
71
|
+
|
72
|
+
# javascript console (Safari/Webkit browsers or Firefox w/Firebug installed)
|
73
|
+
UniformNotifier.console = true
|
74
|
+
# javascript console with options
|
75
|
+
# the attributes key adds custom attributes to the script tag appended to the body
|
76
|
+
UniformNotifier.console = { :attributes => { :nonce => 'mySecret-nonce', 'data-key' => 'value' } }
|
77
|
+
|
78
|
+
# rails logger
|
79
|
+
UniformNotifier.rails_logger = true
|
80
|
+
|
81
|
+
# airbrake
|
82
|
+
UniformNotifier.airbrake = true
|
83
|
+
# airbrake with options
|
84
|
+
UniformNotifier.airbrake = { :error_class => Exception }
|
85
|
+
|
86
|
+
# Honeybadger
|
87
|
+
#
|
88
|
+
# Reporting live data from development is disabled by default. Ensure
|
89
|
+
# that the `report_data` option is enabled via configuration.
|
90
|
+
UniformNotifier.honeybadger = true
|
91
|
+
# Honeybadger with options
|
92
|
+
UniformNotifier.honeybadger = { :error_class => 'Exception' }
|
93
|
+
|
94
|
+
# rollbar
|
95
|
+
UniformNotifier.rollbar = true
|
96
|
+
|
97
|
+
# bugsnag
|
98
|
+
UniformNotifier.bugsnag = true
|
99
|
+
# bugsnag with options
|
100
|
+
UniformNotifier.bugsnag = { :api_key => 'something' }
|
101
|
+
|
102
|
+
# slack
|
103
|
+
UniformNotifier.slack = true
|
104
|
+
# slack with options
|
105
|
+
UniformNotifier.slack = { :webhook_url => 'http://some.slack.url', :channel => '#default', :username => 'notifier' }
|
106
|
+
|
107
|
+
# customized logger
|
108
|
+
logger = File.open('notify.log', 'a+')
|
109
|
+
logger.sync = true
|
110
|
+
UniformNotifier.customized_logger = logger
|
111
|
+
|
112
|
+
# growl without password
|
113
|
+
UniformNotifier.growl = true
|
114
|
+
# growl with passowrd
|
115
|
+
UniformNotifier.growl = { :password => 'growl password' }
|
116
|
+
|
117
|
+
# xmpp
|
118
|
+
UniformNotifier.xmpp = { :account => 'sender_account@jabber.org',
|
119
|
+
:password => 'password_for_jabber',
|
120
|
+
:receiver => 'recipient_account@jabber.org',
|
121
|
+
:show_online_status => true }
|
122
|
+
|
123
|
+
# terminal-notifier
|
124
|
+
UniformNotifier.terminal_notifier = true
|
125
|
+
|
126
|
+
# raise an error
|
127
|
+
UniformNotifier.raise = true # raise a generic exception
|
128
|
+
|
129
|
+
class MyExceptionClass < Exception; end
|
130
|
+
UniformNotifier.raise = MyExceptionClass # raise a custom exception type
|
131
|
+
|
132
|
+
UniformNotifier.raise = false # don't raise errors
|
133
|
+
```
|
132
134
|
|
133
135
|
After that, you can enjoy the notifiers, that's cool!
|
134
136
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
137
|
+
```ruby
|
138
|
+
# the notify message will be notified to rails logger, customized logger, growl or xmpp.
|
139
|
+
UniformNotifier.active_notifiers.each do |notifier|
|
140
|
+
notifier.out_of_channel_notify("customize message")
|
141
|
+
end
|
142
|
+
|
143
|
+
# the notify message will be wrapped by <script type="text/javascript">...</script>,
|
144
|
+
# you should append the javascript_str at the bottom of http response body.
|
145
|
+
# for more information, please check https://github.com/flyerhzm/bullet/blob/master/lib/bullet/rack.rb
|
146
|
+
responses = []
|
147
|
+
UniformNotifier.active_notifiers.each do |notifier|
|
148
|
+
responses << notifier.inline_notify("customize message")
|
149
|
+
end
|
150
|
+
javascript_str = responses.join("\n")
|
151
|
+
```
|
148
152
|
|
149
153
|
## Growl Support
|
150
154
|
|
@@ -10,9 +10,7 @@ class UniformNotifier
|
|
10
10
|
|
11
11
|
def self._out_of_channel_notify(data)
|
12
12
|
opt = {}
|
13
|
-
if UniformNotifier.bugsnag.is_a?(Hash)
|
14
|
-
opt = UniformNotifier.bugsnag
|
15
|
-
end
|
13
|
+
opt = UniformNotifier.bugsnag if UniformNotifier.bugsnag.is_a?(Hash)
|
16
14
|
|
17
15
|
exception = Exception.new(data[:title])
|
18
16
|
exception.set_backtrace(data[:backtrace]) if data[:backtrace]
|
@@ -12,9 +12,7 @@ class UniformNotifier
|
|
12
12
|
message = data.values.compact.join("\n")
|
13
13
|
|
14
14
|
opt = {}
|
15
|
-
if UniformNotifier.sentry.is_a?(Hash)
|
16
|
-
opt = UniformNotifier.sentry
|
17
|
-
end
|
15
|
+
opt = UniformNotifier.sentry if UniformNotifier.sentry.is_a?(Hash)
|
18
16
|
|
19
17
|
exception = Exception.new(message)
|
20
18
|
Raven.capture_exception(exception, opt)
|
data/uniform_notifier.gemspec
CHANGED
@@ -16,6 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.rubyforge_project = 'uniform_notifier'
|
18
18
|
|
19
|
+
s.required_ruby_version = '>= 2.3'
|
20
|
+
|
19
21
|
s.add_development_dependency 'ruby-growl', ['= 4.0']
|
20
22
|
s.add_development_dependency 'ruby_gntp', ['= 0.3.4']
|
21
23
|
s.add_development_dependency 'xmpp4r', ['= 0.5']
|
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.12.
|
4
|
+
version: 1.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-growl
|
@@ -142,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '2.3'
|
146
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
148
|
- - ">="
|