notifier 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +11 -11
- data/README.rdoc +7 -0
- data/lib/notifier.rb +11 -10
- data/lib/notifier/adapters/gntp.rb +18 -20
- data/lib/notifier/terminal_notifier.rb +21 -0
- data/lib/notifier/version.rb +2 -2
- data/notifier.gemspec +1 -1
- data/spec/notifier_spec.rb +1 -1
- metadata +18 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dd923128a3458ecd262b6bb21a948fa6a626ea43
|
4
|
+
data.tar.gz: 2954f0a783b91705f4b389c670a09611808e1242
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71c15cf0499fb9e8896108ee4bba840313c142c79fc19ac0be6faee5fa0b4f38e47cd41f673eaa6e37e2600d75bd37539557eb974607696e7d991f149e4277e2
|
7
|
+
data.tar.gz: 066b7ee6f3fa640f7909d03640a65a9f0f29119b60d137edf97b3641c145fe88ec5738fe1b5c2cc8e2f82e0cfb2f43d6aeeae61a6dd0bc0a556b78bdae1195c6
|
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--color
|
1
|
+
--color
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source
|
1
|
+
source "http://rubygems.org"
|
2
2
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
notifier (0.
|
4
|
+
notifier (0.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
|
-
diff-lcs (1.
|
10
|
-
rake (
|
11
|
-
rspec (2.
|
12
|
-
rspec-core (~> 2.
|
13
|
-
rspec-expectations (~> 2.
|
14
|
-
rspec-mocks (~> 2.
|
15
|
-
rspec-core (2.
|
16
|
-
rspec-expectations (2.
|
17
|
-
diff-lcs (
|
18
|
-
rspec-mocks (2.
|
9
|
+
diff-lcs (1.2.5)
|
10
|
+
rake (10.3.1)
|
11
|
+
rspec (2.14.1)
|
12
|
+
rspec-core (~> 2.14.0)
|
13
|
+
rspec-expectations (~> 2.14.0)
|
14
|
+
rspec-mocks (~> 2.14.0)
|
15
|
+
rspec-core (2.14.8)
|
16
|
+
rspec-expectations (2.14.5)
|
17
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
18
|
+
rspec-mocks (2.14.6)
|
19
19
|
|
20
20
|
PLATFORMS
|
21
21
|
ruby
|
data/README.rdoc
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
Send system notifications on several platforms with a simple and unified API. Currently supports:
|
4
4
|
|
5
5
|
* Growl (Mac OS X)
|
6
|
+
* terminal-notifier (Notification Center wrapper for Mac OS X)
|
6
7
|
* GNTP Protocol (Growl, with Vagrant support)
|
7
8
|
* Kdialog (Linux/KDE)
|
8
9
|
* Knotify (Linux/KDE)
|
@@ -16,10 +17,16 @@ Send system notifications on several platforms with a simple and unified API. Cu
|
|
16
17
|
|
17
18
|
=== Mac OS X
|
18
19
|
|
20
|
+
Growl:
|
21
|
+
|
19
22
|
* Install Growl - http://growl.info/
|
20
23
|
* Install the growlnotify script located on the "Extras" directory
|
21
24
|
* Open the Growl Preference Panel (System > Growl) and activate "Listen for incoming notifications" and "Allow remote application registration" options on the Network tab.
|
22
25
|
|
26
|
+
terminal-notifier:
|
27
|
+
|
28
|
+
* Install terminal-notifier - https://github.com/alloy/terminal-notifier
|
29
|
+
|
23
30
|
=== Linux
|
24
31
|
|
25
32
|
If you're a linux guy, you can choose one of these methods:
|
data/lib/notifier.rb
CHANGED
@@ -5,16 +5,17 @@ require "timeout"
|
|
5
5
|
require "rbconfig"
|
6
6
|
|
7
7
|
module Notifier
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
require "notifier/growl"
|
9
|
+
require "notifier/gntp"
|
10
|
+
require "notifier/snarl"
|
11
|
+
require "notifier/osd_cat"
|
12
|
+
require "notifier/knotify"
|
13
|
+
require "notifier/kdialog"
|
14
|
+
require "notifier/notify_send"
|
15
|
+
require "notifier/placebo"
|
16
|
+
require "notifier/terminal_notifier"
|
17
|
+
require "notifier/version"
|
18
|
+
require "notifier/adapters"
|
18
19
|
|
19
20
|
extend self
|
20
21
|
|
@@ -46,18 +46,18 @@ module Notifier
|
|
46
46
|
|
47
47
|
icon = fetch_icon(options[:icon])
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
49
|
+
write "GNTP/1.0 NOTIFY NONE",
|
50
|
+
"Application-Name: #{application_name}",
|
51
|
+
"Notification-Name: #{name}",
|
52
|
+
"Notification-Title: #{options[:title]}",
|
53
|
+
"Notification-Text: #{options[:message]}",
|
54
|
+
"Notification-Icon: x-growl-resource://#{icon[:identifier]}",
|
55
|
+
"Notification-Sticky: #{bool options[:sticky]}",
|
56
|
+
nil,
|
57
|
+
"Identifier: #{icon[:identifier]}",
|
58
|
+
"Length: #{icon[:size]}",
|
59
|
+
nil,
|
60
|
+
icon[:contents]
|
61
61
|
end
|
62
62
|
|
63
63
|
def fetch_icon(path)
|
@@ -75,14 +75,12 @@ module Notifier
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def register(name)
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
"Notification-Enabled: True"
|
85
|
-
)
|
78
|
+
write "GNTP/1.0 REGISTER NONE",
|
79
|
+
"Application-Name: #{application_name}",
|
80
|
+
"Notifications-count: 1",
|
81
|
+
nil,
|
82
|
+
"Notification-Name: #{name}",
|
83
|
+
"Notification-Enabled: True"
|
86
84
|
end
|
87
85
|
end
|
88
86
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Notifier
|
2
|
+
module TerminalNotifier
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def supported?
|
6
|
+
Notifier.os?(/darwin/) && `which terminal-notifier` && $? == 0
|
7
|
+
end
|
8
|
+
|
9
|
+
def notify(options)
|
10
|
+
command = [
|
11
|
+
"terminal-notifier",
|
12
|
+
"-group", "notifier-rubygems",
|
13
|
+
"-title", options[:title],
|
14
|
+
"-appIcon", options.fetch(:image, ""),
|
15
|
+
"-message", options[:message]
|
16
|
+
]
|
17
|
+
|
18
|
+
Thread.new { system(*command) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/notifier/version.rb
CHANGED
data/notifier.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
|
20
|
-
s.requirements << "Growl, Libnotify, OSD, KDE (Knotify and Kdialog) or Snarl"
|
20
|
+
s.requirements << "Growl, terminal-notifier, Libnotify, OSD, KDE (Knotify and Kdialog) or Snarl"
|
21
21
|
|
22
22
|
s.add_development_dependency "rspec"
|
23
23
|
s.add_development_dependency "rake"
|
data/spec/notifier_spec.rb
CHANGED
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nando Vieira
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
description: Send system notifications on several platforms with a simple and unified
|
@@ -51,8 +46,8 @@ executables: []
|
|
51
46
|
extensions: []
|
52
47
|
extra_rdoc_files: []
|
53
48
|
files:
|
54
|
-
- .gitignore
|
55
|
-
- .rspec
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
56
51
|
- Gemfile
|
57
52
|
- Gemfile.lock
|
58
53
|
- README.rdoc
|
@@ -68,6 +63,7 @@ files:
|
|
68
63
|
- lib/notifier/osd_cat.rb
|
69
64
|
- lib/notifier/placebo.rb
|
70
65
|
- lib/notifier/snarl.rb
|
66
|
+
- lib/notifier/terminal_notifier.rb
|
71
67
|
- lib/notifier/version.rb
|
72
68
|
- notifier.gemspec
|
73
69
|
- resources/register-growl.scpt
|
@@ -75,28 +71,29 @@ files:
|
|
75
71
|
- spec/spec_helper.rb
|
76
72
|
homepage: http://rubygems.org/gems/notifier
|
77
73
|
licenses: []
|
74
|
+
metadata: {}
|
78
75
|
post_install_message:
|
79
76
|
rdoc_options: []
|
80
77
|
require_paths:
|
81
78
|
- lib
|
82
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
80
|
requirements:
|
85
|
-
- -
|
81
|
+
- - ">="
|
86
82
|
- !ruby/object:Gem::Version
|
87
83
|
version: '0'
|
88
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
85
|
requirements:
|
91
|
-
- -
|
86
|
+
- - ">="
|
92
87
|
- !ruby/object:Gem::Version
|
93
88
|
version: '0'
|
94
89
|
requirements:
|
95
|
-
- Growl, Libnotify, OSD, KDE (Knotify and Kdialog) or Snarl
|
90
|
+
- Growl, terminal-notifier, Libnotify, OSD, KDE (Knotify and Kdialog) or Snarl
|
96
91
|
rubyforge_project:
|
97
|
-
rubygems_version:
|
92
|
+
rubygems_version: 2.2.2
|
98
93
|
signing_key:
|
99
|
-
specification_version:
|
94
|
+
specification_version: 4
|
100
95
|
summary: Send system notifications on several platforms with a simple and unified
|
101
96
|
API. Currently supports Growl, Libnotify, OSD, KDE (Knotify and Kdialog) and Snarl
|
102
|
-
test_files:
|
97
|
+
test_files:
|
98
|
+
- spec/notifier_spec.rb
|
99
|
+
- spec/spec_helper.rb
|