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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3f2979ce33c13c90d2320d9bef380c7b0133665
4
- data.tar.gz: 93aaea64daf52066249fca6c02d07d0d0427f69d
3
+ metadata.gz: e7e963149f3344c23cc7333cbac335fb3616ca9b
4
+ data.tar.gz: a495c1280204ba9cb06ff925ebc6c1f430cbc958
5
5
  SHA512:
6
- metadata.gz: c04c26cc3cc1f32e688ec9856b48b340c80b80b3336e4fb1e29aa585257aeec4f9cb4fdfd0d86d5f055802e67b163701ab9ce89640366f7818765544f50e57b3
7
- data.tar.gz: 56c43912355868052f85c04a00802119088678e021beee928550f05c7861067a365b855eba3679ef5d8a6d65eb5c6f4d32e121ef7675b1a988e7a3baaca57571
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. Download the script and make it executable.
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
- - Allow to work on Mac
15
- - Package as a gem
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
- title = "<b>#{title}</b>"
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
- message = %Q|<a href="http://vote.code4lib.org/election/results/#{opts[:vote]}">Code4Lib Vote</a>|
69
- message << "\nRANK: #{rank}\nscore: #{score}\nhigh score: #{ordered_results.first['score']}\n\n"
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
- message << top_ten.join("\n\n")
74
- message << "\n\n--------------\n\n"
75
- message << top_rest.join("\n\n")
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
- FileUtils.mkdir_p logfile unless File.exist? logfile
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
@@ -1,7 +1,7 @@
1
1
  module Code4lib
2
2
  module Vote
3
3
  module Notifier
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
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.1
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