uniform_notifier 1.0.2 → 1.1.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.
- data/.gitignore +1 -0
- data/README.md +9 -2
- data/lib/uniform_notifier.rb +3 -2
- data/lib/uniform_notifier/airbrake.rb +13 -0
- data/lib/uniform_notifier/version.rb +1 -1
- data/spec/uniform_notifier/airbrake_spec.rb +18 -0
- metadata +14 -12
- data/Gemfile.lock +0 -30
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
UniformNotifier
|
2
2
|
===============
|
3
3
|
|
4
|
-
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, and
|
4
|
+
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
5
|
|
6
6
|
Install
|
7
7
|
-------
|
@@ -22,11 +22,15 @@ if you want to notify by xmpp, you should install xmpp4r first
|
|
22
22
|
|
23
23
|
gem install xmpp4r
|
24
24
|
|
25
|
+
if you want to notify by airbrake, you should install airbrake first
|
26
|
+
|
27
|
+
gem install airbrake
|
28
|
+
|
25
29
|
### add it into Gemfile (Bundler)
|
26
30
|
|
27
31
|
gem "uniform_notifier"
|
28
32
|
|
29
|
-
you should add ruby-growl, ruby_gntp,
|
33
|
+
you should add ruby-growl, ruby_gntp, xmpp4r, airbrake gem if you want.
|
30
34
|
|
31
35
|
Usage
|
32
36
|
-----
|
@@ -46,6 +50,9 @@ By default, all notifiers are disabled, you should enable them first.
|
|
46
50
|
# rails logger
|
47
51
|
UniformNotifier.rails_logger = true
|
48
52
|
|
53
|
+
# airbrake
|
54
|
+
UniformNotifier.airbrake = true
|
55
|
+
|
49
56
|
# customized logger
|
50
57
|
logger = File.open('notify.log', 'a+')
|
51
58
|
logger.sync = true
|
data/lib/uniform_notifier.rb
CHANGED
@@ -5,14 +5,15 @@ require 'uniform_notifier/growl'
|
|
5
5
|
require 'uniform_notifier/xmpp'
|
6
6
|
require 'uniform_notifier/rails_logger'
|
7
7
|
require 'uniform_notifier/customized_logger'
|
8
|
+
require 'uniform_notifier/airbrake'
|
8
9
|
|
9
10
|
module UniformNotifier
|
10
11
|
class NotificationError < StandardError; end
|
11
12
|
|
12
13
|
class <<self
|
13
|
-
attr_accessor :alert, :console, :growl, :rails_logger, :xmpp
|
14
|
+
attr_accessor :alert, :console, :growl, :rails_logger, :xmpp, :airbrake
|
14
15
|
|
15
|
-
NOTIFIERS = [JavascriptAlert, JavascriptConsole, Growl, Xmpp, RailsLogger, CustomizedLogger]
|
16
|
+
NOTIFIERS = [JavascriptAlert, JavascriptConsole, Growl, Xmpp, RailsLogger, CustomizedLogger, AirbrakeNotifier]
|
16
17
|
|
17
18
|
def active_notifiers
|
18
19
|
NOTIFIERS.select { |notifier| notifier.active? }
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module UniformNotifier
|
2
|
+
class AirbrakeNotifier < Base
|
3
|
+
def self.active?
|
4
|
+
UniformNotifier.airbrake
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.out_of_channel_notify(message)
|
8
|
+
return unless active?
|
9
|
+
exception = Exception.new(message)
|
10
|
+
Airbrake.notify(exception)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
class Airbrake
|
4
|
+
# mock Airbrake
|
5
|
+
end
|
6
|
+
|
7
|
+
describe UniformNotifier::AirbrakeNotifier do
|
8
|
+
it "should not notify airbrake" do
|
9
|
+
UniformNotifier::AirbrakeNotifier.out_of_channel_notify("notify airbrake").should be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should notify airbrake" do
|
13
|
+
Airbrake.should_receive(:notify).with(Exception.new("notify airbrake"))
|
14
|
+
|
15
|
+
UniformNotifier.airbrake = true
|
16
|
+
UniformNotifier::AirbrakeNotifier.out_of_channel_notify("notify airbrake")
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniform_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby-growl
|
16
|
-
requirement: &
|
16
|
+
requirement: &70177925145660 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70177925145660
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: ruby_gntp
|
27
|
-
requirement: &
|
27
|
+
requirement: &70177925144300 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - =
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.3.4
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70177925144300
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: xmpp4r
|
38
|
-
requirement: &
|
38
|
+
requirement: &70177925143220 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - =
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0.5'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70177925143220
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70177925142220 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70177925142220
|
58
58
|
description: uniform notifier for rails logger, customized logger, javascript alert,
|
59
59
|
javascript console, growl and xmpp
|
60
60
|
email:
|
@@ -65,11 +65,11 @@ extra_rdoc_files: []
|
|
65
65
|
files:
|
66
66
|
- .gitignore
|
67
67
|
- Gemfile
|
68
|
-
- Gemfile.lock
|
69
68
|
- LICENSE
|
70
69
|
- README.md
|
71
70
|
- Rakefile
|
72
71
|
- lib/uniform_notifier.rb
|
72
|
+
- lib/uniform_notifier/airbrake.rb
|
73
73
|
- lib/uniform_notifier/base.rb
|
74
74
|
- lib/uniform_notifier/customized_logger.rb
|
75
75
|
- lib/uniform_notifier/growl.rb
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- lib/uniform_notifier/version.rb
|
80
80
|
- lib/uniform_notifier/xmpp.rb
|
81
81
|
- spec/spec_helper.rb
|
82
|
+
- spec/uniform_notifier/airbrake_spec.rb
|
82
83
|
- spec/uniform_notifier/customized_logger_spec.rb
|
83
84
|
- spec/uniform_notifier/growl_spec.rb
|
84
85
|
- spec/uniform_notifier/javascript_alert_spec.rb
|
@@ -106,13 +107,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
109
|
rubyforge_project: uniform_notifier
|
109
|
-
rubygems_version: 1.8.
|
110
|
+
rubygems_version: 1.8.17
|
110
111
|
signing_key:
|
111
112
|
specification_version: 3
|
112
113
|
summary: uniform notifier for rails logger, customized logger, javascript alert, javascript
|
113
114
|
console, growl and xmpp
|
114
115
|
test_files:
|
115
116
|
- spec/spec_helper.rb
|
117
|
+
- spec/uniform_notifier/airbrake_spec.rb
|
116
118
|
- spec/uniform_notifier/customized_logger_spec.rb
|
117
119
|
- spec/uniform_notifier/growl_spec.rb
|
118
120
|
- spec/uniform_notifier/javascript_alert_spec.rb
|
data/Gemfile.lock
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
uniform_notifier (1.0.2)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: http://rubygems.org/
|
8
|
-
specs:
|
9
|
-
diff-lcs (1.1.3)
|
10
|
-
rspec (2.8.0)
|
11
|
-
rspec-core (~> 2.8.0)
|
12
|
-
rspec-expectations (~> 2.8.0)
|
13
|
-
rspec-mocks (~> 2.8.0)
|
14
|
-
rspec-core (2.8.0)
|
15
|
-
rspec-expectations (2.8.0)
|
16
|
-
diff-lcs (~> 1.1.2)
|
17
|
-
rspec-mocks (2.8.0)
|
18
|
-
ruby-growl (3.0)
|
19
|
-
ruby_gntp (0.3.4)
|
20
|
-
xmpp4r (0.5)
|
21
|
-
|
22
|
-
PLATFORMS
|
23
|
-
ruby
|
24
|
-
|
25
|
-
DEPENDENCIES
|
26
|
-
rspec
|
27
|
-
ruby-growl (= 3.0)
|
28
|
-
ruby_gntp (= 0.3.4)
|
29
|
-
uniform_notifier!
|
30
|
-
xmpp4r (= 0.5)
|