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.
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.1"
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
- return posts if posts.length == 0
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
- title = "The Grid"
16
- if posts.length == 1
17
- subtitle = "You have a new message."
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
- senders = posts.map { |p|
23
- p.send(p.known_attributes.first).from_username
24
- }.uniq
25
+ if senders.length > 3
26
+ senders = senders.slice(0, 3) + ["and others"]
27
+ end
25
28
 
26
- if senders.length > 3
27
- senders = senders.slice(0, 3) + ["and others"]
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.1
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.markdown
50
+ - README.rdoc
51
51
  - Rakefile
52
52
  - grid-plugin-osx-notifier.gemspec
53
53
  - lib/grid-plugin-osx-notifier.rb