code4lib-vote-notifier 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +7 -3
- data/bin/code4lib-vote +15 -9
- data/lib/code4lib/vote/notifier/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7e963149f3344c23cc7333cbac335fb3616ca9b
|
4
|
+
data.tar.gz: a495c1280204ba9cb06ff925ebc6c1f430cbc958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4771018d7aa75f5740c49978554ce11527a715c712cc5f30df7f50d3aebfe3b923309b83f207e743ebe5045ca37e1dbec492e8061f2d884a3dd2a5b6e05236fc
|
7
|
+
data.tar.gz: 6d87e1cf290814626c7a1ca41ac6e4c665a1f4c95b54b6b6f33b7c040746769c1a06fc2959af4adee8b3310fa9bc820144b038d176db72c6ad29f4e26c63d3b3
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/README.md
CHANGED
@@ -4,13 +4,17 @@ Save your F5 key for tracking packages and get desktop notifications to find out
|
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
7
|
-
1.
|
7
|
+
1. `gem install code4lib-vote-notifier`
|
8
8
|
2. Install the required gems.
|
9
|
+
|
10
|
+
Linux: `gem install libnotify`
|
11
|
+
Mac: `gem install terminal-notifier`
|
12
|
+
|
9
13
|
3. `code4lib-vote --help`
|
10
14
|
|
11
15
|
|
12
16
|
## TODO
|
13
17
|
- Trottle notifications to only show them when something has changed or a threshold is passed
|
14
|
-
-
|
15
|
-
|
18
|
+
- Get it working on Mac
|
19
|
+
|
16
20
|
|
data/bin/code4lib-vote
CHANGED
@@ -58,33 +58,39 @@ ordered_results.each_with_index do |talk, index|
|
|
58
58
|
if talk['id'] == opts[:mytalk]
|
59
59
|
rank = index + 1
|
60
60
|
score = talk['score']
|
61
|
-
|
61
|
+
if platform == 'linux'
|
62
|
+
title = "<b>#{title}</b>"
|
63
|
+
end
|
62
64
|
end
|
63
65
|
talks_list << "#{talk['score']} #{title}"
|
64
66
|
end
|
65
67
|
|
66
68
|
top_talks = talks_list.slice(0,opts[:top])
|
67
69
|
|
68
|
-
|
69
|
-
|
70
|
+
|
71
|
+
main_message = "\nRANK: #{rank}\nscore: #{score}\nhigh score: #{ordered_results.first['score']}\n\n"
|
70
72
|
|
71
73
|
top_ten = top_talks.slice(0,10)
|
72
74
|
top_rest = top_talks.slice(10,top_talks.length)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
puts message
|
75
|
+
main_message << top_ten.join("\n\n")
|
76
|
+
main_message << "\n\n--------------\n\n"
|
77
|
+
main_message << top_rest.join("\n\n")
|
78
78
|
|
79
79
|
case platform
|
80
80
|
when 'linux'
|
81
|
+
message_link = %Q|<a href="http://vote.code4lib.org/election/results/#{opts[:vote]}">Code4Lib Vote</a>|
|
82
|
+
message = message_link + main_message
|
81
83
|
Libnotify.show(:body => message, :timeout => opts[:timeout], icon_path: opts[:icon])
|
82
84
|
when 'mac'
|
85
|
+
message = main_message
|
83
86
|
`terminal-notifier -message "#{message}" -appIcon #{opts[:icon]} -title "Code4Lib Vote" -url "http://vote.code4lib.org/election/results/#{opts[:vote]}"`
|
84
87
|
end
|
85
88
|
|
89
|
+
puts message
|
90
|
+
|
86
91
|
logfile = File.expand_path('~/tmp/code4lib-vote.log')
|
87
|
-
|
92
|
+
logpath = File.expand_path('~/tmp/')
|
93
|
+
FileUtils.mkdir_p logpath unless File.exist? logpath
|
88
94
|
|
89
95
|
File.open(logfile, 'a') do |fh|
|
90
96
|
fh.puts DateTime.now.to_s
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code4lib-vote-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Ronallo
|
@@ -88,6 +88,7 @@ executables:
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
+
- ".gitignore"
|
91
92
|
- Gemfile
|
92
93
|
- Gemfile.lock
|
93
94
|
- MIT-LICENSE
|