uniform_notifier 1.4.0 → 1.5.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 +12 -10
- data/lib/uniform_notifier.rb +3 -1
- data/lib/uniform_notifier/bugsnag.rb +13 -0
- data/lib/uniform_notifier/errors.rb +3 -0
- data/lib/uniform_notifier/growl.rb +2 -2
- data/lib/uniform_notifier/raise.rb +1 -3
- data/lib/uniform_notifier/version.rb +1 -1
- data/spec/uniform_notifier/airbrake_spec.rb +1 -1
- data/spec/uniform_notifier/bugsnag_spec.rb +18 -0
- data/spec/uniform_notifier/growl_spec.rb +12 -0
- data/spec/uniform_notifier/raise_spec.rb +1 -1
- metadata +14 -10
- data/CONTRIBUTORS +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26d6f86098312bf5878fca405b3bf651089d4c5b
|
4
|
+
data.tar.gz: e71a2a6610ac742438c4d113af2be3622e736ae1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31e976a8477db1b6e0828f68f96f649817f1fd83442f26cc2432035a8bed44fb13181b116f39d10c4423703b27e1ff8881a1ecb2c523197eecfd3fa60a539931
|
7
|
+
data.tar.gz: e0f3976a882378ad18457852c595eddf2c7c83461e476683a179d477354c3d31adb24350bca4a44702a0886b27d825d56b175e744c110b06361c047a777f03a6
|
data/README.md
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
UniformNotifier
|
2
|
-
===============
|
1
|
+
# UniformNotifier
|
3
2
|
|
4
3
|
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 and airbrake.
|
5
4
|
|
6
|
-
Install
|
7
|
-
-------
|
5
|
+
## Install
|
8
6
|
|
9
7
|
### install directly
|
10
8
|
|
@@ -26,14 +24,17 @@ if you want to notify by airbrake, you should install airbrake first
|
|
26
24
|
|
27
25
|
gem install airbrake
|
28
26
|
|
27
|
+
if you want to notify by bugsnag, you should install bugsnag first
|
28
|
+
|
29
|
+
gem install bugsnag
|
30
|
+
|
29
31
|
### add it into Gemfile (Bundler)
|
30
32
|
|
31
33
|
gem "uniform_notifier"
|
32
34
|
|
33
35
|
you should add ruby-growl, ruby_gntp, xmpp4r, airbrake gem if you want.
|
34
36
|
|
35
|
-
Usage
|
36
|
-
-----
|
37
|
+
## Usage
|
37
38
|
|
38
39
|
There are two types of notifications,
|
39
40
|
one is <code>inline_notify</code>, for javascript alert and javascript console notifiers, which returns a string and will be combined,
|
@@ -53,6 +54,9 @@ By default, all notifiers are disabled, you should enable them first.
|
|
53
54
|
# airbrake
|
54
55
|
UniformNotifier.airbrake = true
|
55
56
|
|
57
|
+
# bugsnag
|
58
|
+
UniformNotifier.bugsnag = true
|
59
|
+
|
56
60
|
# customized logger
|
57
61
|
logger = File.open('notify.log', 'a+')
|
58
62
|
logger.sync = true
|
@@ -93,8 +97,7 @@ After that, you can enjoy the notifiers, that's cool!
|
|
93
97
|
end
|
94
98
|
javascript_str = responses.join("\n")
|
95
99
|
|
96
|
-
Growl Support
|
97
|
-
-------------
|
100
|
+
## Growl Support
|
98
101
|
|
99
102
|
To get Growl support up-and-running, follow the steps below:
|
100
103
|
|
@@ -110,8 +113,7 @@ To get Growl support up-and-running, follow the steps below:
|
|
110
113
|
|
111
114
|
ruby-growl gem has an issue about md5 in ruby 1.9, if you use growl and ruby 1.9, check this [gist][1]
|
112
115
|
|
113
|
-
XMPP/Jabber Support
|
114
|
-
-------------------
|
116
|
+
## XMPP/Jabber Support
|
115
117
|
|
116
118
|
To get XMPP support up-and-running, follow the steps below:
|
117
119
|
|
data/lib/uniform_notifier.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'uniform_notifier/base'
|
2
|
+
require 'uniform_notifier/errors'
|
2
3
|
require 'uniform_notifier/javascript_alert'
|
3
4
|
require 'uniform_notifier/javascript_console'
|
4
5
|
require 'uniform_notifier/growl'
|
@@ -6,13 +7,14 @@ require 'uniform_notifier/xmpp'
|
|
6
7
|
require 'uniform_notifier/rails_logger'
|
7
8
|
require 'uniform_notifier/customized_logger'
|
8
9
|
require 'uniform_notifier/airbrake'
|
10
|
+
require 'uniform_notifier/bugsnag'
|
9
11
|
require 'uniform_notifier/raise'
|
10
12
|
|
11
13
|
module UniformNotifier
|
12
14
|
class NotificationError < StandardError; end
|
13
15
|
|
14
16
|
class <<self
|
15
|
-
attr_accessor :alert, :console, :growl, :rails_logger, :xmpp, :airbrake, :raise
|
17
|
+
attr_accessor :alert, :console, :growl, :rails_logger, :xmpp, :airbrake, :bugsnag, :raise
|
16
18
|
|
17
19
|
NOTIFIERS = [JavascriptAlert, JavascriptConsole, Growl, Xmpp, RailsLogger, CustomizedLogger, AirbrakeNotifier, Raise]
|
18
20
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module UniformNotifier
|
2
|
+
class BugsnagNotifier < Base
|
3
|
+
def self.active?
|
4
|
+
UniformNotifier.bugsnag
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.out_of_channel_notify(message)
|
8
|
+
return unless active?
|
9
|
+
exception = Exception.new(message)
|
10
|
+
Bugsnag.notify(exception)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -30,7 +30,7 @@ module UniformNotifier
|
|
30
30
|
@growl.add_notification 'uniform_notifier'
|
31
31
|
@growl.password = @password
|
32
32
|
|
33
|
-
notify 'Uniform Notifier Growl has been turned on'
|
33
|
+
notify 'Uniform Notifier Growl has been turned on' if !growl.instance_of?(Hash) || !growl[:quiet]
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.setup_connection_gntp( growl )
|
@@ -43,7 +43,7 @@ module UniformNotifier
|
|
43
43
|
:enabled => true,
|
44
44
|
}]})
|
45
45
|
|
46
|
-
notify 'Uniform Notifier Growl has been turned on (using GNTP)'
|
46
|
+
notify 'Uniform Notifier Growl has been turned on (using GNTP)' if !growl.instance_of?(Hash) || !growl[:quiet]
|
47
47
|
end
|
48
48
|
|
49
49
|
private
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module UniformNotifier
|
2
2
|
class Raise < Base
|
3
|
-
class UniformNotifierException < Exception; end
|
4
|
-
|
5
3
|
def self.active?
|
6
4
|
@exception_class
|
7
5
|
end
|
@@ -13,7 +11,7 @@ module UniformNotifier
|
|
13
11
|
end
|
14
12
|
|
15
13
|
def self.setup_connection(exception_class)
|
16
|
-
@exception_class = exception_class == true ?
|
14
|
+
@exception_class = exception_class == true ? Exception : exception_class
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
@@ -10,7 +10,7 @@ describe UniformNotifier::AirbrakeNotifier do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should notify airbrake" do
|
13
|
-
Airbrake.should_receive(:notify).with(Exception.new("notify airbrake"))
|
13
|
+
Airbrake.should_receive(:notify).with(UniformNotifier::Exception.new("notify airbrake"))
|
14
14
|
|
15
15
|
UniformNotifier.airbrake = true
|
16
16
|
UniformNotifier::AirbrakeNotifier.out_of_channel_notify("notify airbrake")
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
class Bugsnag
|
4
|
+
# mock Bugsnag
|
5
|
+
end
|
6
|
+
|
7
|
+
describe UniformNotifier::BugsnagNotifier do
|
8
|
+
it "should not notify bugsnag" do
|
9
|
+
UniformNotifier::BugsnagNotifier.out_of_channel_notify("notify bugsnag").should be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should notify bugsnag" do
|
13
|
+
Bugsnag.should_receive(:notify).with(UniformNotifier::Exception.new("notify bugsnag"))
|
14
|
+
|
15
|
+
UniformNotifier.bugsnag = true
|
16
|
+
UniformNotifier::BugsnagNotifier.out_of_channel_notify("notify bugsnag")
|
17
|
+
end
|
18
|
+
end
|
@@ -29,4 +29,16 @@ describe UniformNotifier::Growl do
|
|
29
29
|
UniformNotifier.growl = { :password => '123456' }
|
30
30
|
UniformNotifier::Growl.out_of_channel_notify('notify growl with password')
|
31
31
|
end
|
32
|
+
|
33
|
+
it "should notify growl with quiet" do
|
34
|
+
growl = double('growl', :is_a? => true)
|
35
|
+
Growl.should_receive(:new).with('localhost', 'uniform_notifier').and_return(growl)
|
36
|
+
growl.should_receive(:add_notification).with('uniform_notifier')
|
37
|
+
growl.should_receive(:password=).with('123456')
|
38
|
+
growl.should_not_receive(:notify).with('uniform_notifier', 'Uniform Notifier', 'Uniform Notifier Growl has been turned on')
|
39
|
+
growl.should_receive(:notify).with('uniform_notifier', 'Uniform Notifier', 'notify growl with password')
|
40
|
+
|
41
|
+
UniformNotifier.growl = { :password => '123456', :quiet => true }
|
42
|
+
UniformNotifier::Growl.out_of_channel_notify('notify growl with password')
|
43
|
+
end
|
32
44
|
end
|
@@ -9,7 +9,7 @@ describe UniformNotifier::Raise do
|
|
9
9
|
UniformNotifier.raise = true
|
10
10
|
expect {
|
11
11
|
UniformNotifier::Raise.out_of_channel_notify("notification")
|
12
|
-
}.to raise_error(UniformNotifier::
|
12
|
+
}.to raise_error(UniformNotifier::Exception, "notification")
|
13
13
|
end
|
14
14
|
|
15
15
|
it "allows the user to override the default exception class" do
|
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.5.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: 2014-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-growl
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: uniform notifier for rails logger, customized logger, javascript alert,
|
@@ -74,9 +74,8 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- .gitignore
|
78
|
-
- .travis.yml
|
79
|
-
- CONTRIBUTORS
|
77
|
+
- ".gitignore"
|
78
|
+
- ".travis.yml"
|
80
79
|
- Gemfile
|
81
80
|
- LICENSE
|
82
81
|
- README.md
|
@@ -84,7 +83,9 @@ files:
|
|
84
83
|
- lib/uniform_notifier.rb
|
85
84
|
- lib/uniform_notifier/airbrake.rb
|
86
85
|
- lib/uniform_notifier/base.rb
|
86
|
+
- lib/uniform_notifier/bugsnag.rb
|
87
87
|
- lib/uniform_notifier/customized_logger.rb
|
88
|
+
- lib/uniform_notifier/errors.rb
|
88
89
|
- lib/uniform_notifier/growl.rb
|
89
90
|
- lib/uniform_notifier/javascript_alert.rb
|
90
91
|
- lib/uniform_notifier/javascript_console.rb
|
@@ -94,6 +95,7 @@ files:
|
|
94
95
|
- lib/uniform_notifier/xmpp.rb
|
95
96
|
- spec/spec_helper.rb
|
96
97
|
- spec/uniform_notifier/airbrake_spec.rb
|
98
|
+
- spec/uniform_notifier/bugsnag_spec.rb
|
97
99
|
- spec/uniform_notifier/customized_logger_spec.rb
|
98
100
|
- spec/uniform_notifier/growl_spec.rb
|
99
101
|
- spec/uniform_notifier/javascript_alert_spec.rb
|
@@ -111,17 +113,17 @@ require_paths:
|
|
111
113
|
- lib
|
112
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
115
|
requirements:
|
114
|
-
- -
|
116
|
+
- - ">="
|
115
117
|
- !ruby/object:Gem::Version
|
116
118
|
version: '0'
|
117
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
120
|
requirements:
|
119
|
-
- -
|
121
|
+
- - ">="
|
120
122
|
- !ruby/object:Gem::Version
|
121
123
|
version: '0'
|
122
124
|
requirements: []
|
123
125
|
rubyforge_project: uniform_notifier
|
124
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.2.2
|
125
127
|
signing_key:
|
126
128
|
specification_version: 4
|
127
129
|
summary: uniform notifier for rails logger, customized logger, javascript alert, javascript
|
@@ -129,6 +131,7 @@ summary: uniform notifier for rails logger, customized logger, javascript alert,
|
|
129
131
|
test_files:
|
130
132
|
- spec/spec_helper.rb
|
131
133
|
- spec/uniform_notifier/airbrake_spec.rb
|
134
|
+
- spec/uniform_notifier/bugsnag_spec.rb
|
132
135
|
- spec/uniform_notifier/customized_logger_spec.rb
|
133
136
|
- spec/uniform_notifier/growl_spec.rb
|
134
137
|
- spec/uniform_notifier/javascript_alert_spec.rb
|
@@ -136,3 +139,4 @@ test_files:
|
|
136
139
|
- spec/uniform_notifier/rails_logger_spec.rb
|
137
140
|
- spec/uniform_notifier/raise_spec.rb
|
138
141
|
- spec/uniform_notifier/xmpp_spec.rb
|
142
|
+
has_rdoc:
|
data/CONTRIBUTORS
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
Alexey Bobyrev <alexey.bobyrev@gmail.com>
|
2
|
-
Brian Kelly <polymonic@gmail.com>
|
3
|
-
Dan Finnie <dan@danfinnie.com>
|
4
|
-
Flip Sasser <flip@x451.com>
|
5
|
-
Ian Duggan <ian@ianduggan.net>
|
6
|
-
Konstantin Kosmatov <key@kosmatov.su>
|
7
|
-
Richard Huang <flyerhzm@gmail.com>
|
8
|
-
Steven Soroka <ssoroka78@gmail.com>
|
9
|
-
tinogomes <tinorj@gmail.com>
|