grid-plugin-osx-notifier 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.markdown → README.rdoc} +0 -0
- data/lib/grid-plugin-osx-notifier.rb +16 -15
- metadata +2 -2
File without changes
|
@@ -4,30 +4,31 @@ require 'terminal-notifier'
|
|
4
4
|
module Grid
|
5
5
|
module Plugin
|
6
6
|
module OSXNotifier
|
7
|
-
VERSION = "0.0.
|
7
|
+
VERSION = "0.0.2"
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
GridCLI.hooker.register(:after_update) { |posts|
|
13
|
-
|
13
|
+
if posts.length > 0
|
14
|
+
title = "The Grid"
|
15
|
+
if posts.length == 1
|
16
|
+
subtitle = "You have a new message."
|
17
|
+
else
|
18
|
+
subtitle = "You have #{posts.length} new messages."
|
19
|
+
end
|
14
20
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
else
|
19
|
-
subtitle = "You have #{posts.length} new messages."
|
20
|
-
end
|
21
|
+
senders = posts.map { |p|
|
22
|
+
p.send(p.known_attributes.first).from_username
|
23
|
+
}.uniq
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
if senders.length > 3
|
26
|
+
senders = senders.slice(0, 3) + ["and others"]
|
27
|
+
end
|
25
28
|
|
26
|
-
|
27
|
-
|
29
|
+
msg = "From " + senders.join(", ")
|
30
|
+
TerminalNotifier.notify(msg, :title => title, :subtitle => subtitle)
|
28
31
|
end
|
29
32
|
|
30
|
-
msg = "From " + senders.join(", ")
|
31
|
-
TerminalNotifier.notify(msg, :title => title, :subtitle => subtitle)
|
32
33
|
posts
|
33
34
|
}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: grid-plugin-osx-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Brian Muller
|
@@ -47,7 +47,7 @@ files:
|
|
47
47
|
- .gitignore
|
48
48
|
- .rvmrc
|
49
49
|
- Gemfile
|
50
|
-
- README.
|
50
|
+
- README.rdoc
|
51
51
|
- Rakefile
|
52
52
|
- grid-plugin-osx-notifier.gemspec
|
53
53
|
- lib/grid-plugin-osx-notifier.rb
|