notifaction 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/notify.rb +4 -4
- data/lib/plugin.rb +2 -2
- data/lib/plugins/workingon.rb +15 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 122a6f40d80d0d05e98fd6494288bb7dcf111677
|
4
|
+
data.tar.gz: df6ba02198ede8326019a6e656d51bcec7d00f41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0968f3fb41fc5212435ce06b5677119510c0c05a9cbff9d6243c929c0d338be1b5990a0127a34bc41bac5656d182e1c5f9eb58568e74e048a850f9f4510c8f45
|
7
|
+
data.tar.gz: 3acdb921f0a32becab0886b4f73f73631d003744f5dbe8d97a968de00bf99a85656b9b8e64f3a3cacffd712e03196dbe3b1e0501a42d063eac40aaca82d01df9
|
data/lib/notify.rb
CHANGED
@@ -109,7 +109,7 @@ class Notify
|
|
109
109
|
puts Style.format(message, colour, style)
|
110
110
|
end
|
111
111
|
|
112
|
-
def osx_notification(message, title)
|
112
|
+
def self.osx_notification(message, title)
|
113
113
|
begin
|
114
114
|
@response = `osascript -e 'display notification "#{message}" with title "#{title}"'`
|
115
115
|
|
@@ -120,7 +120,7 @@ class Notify
|
|
120
120
|
end
|
121
121
|
|
122
122
|
# OSX system modal popup
|
123
|
-
def osx_modal(message, title, icon = :caution)
|
123
|
+
def self.osx_modal(message, title, icon = :caution)
|
124
124
|
begin
|
125
125
|
@response = `osascript -e 'tell app "System Events" to display dialog "#{message}" buttons {"OK"} default button 1 with title "#{title}" with icon #{icon}'`
|
126
126
|
|
@@ -131,7 +131,7 @@ class Notify
|
|
131
131
|
end
|
132
132
|
|
133
133
|
# Linux system notification
|
134
|
-
def notifysend(message, title)
|
134
|
+
def self.notifysend(message, title)
|
135
135
|
begin
|
136
136
|
@response = `notify-send "#{title}" "#{message}"`
|
137
137
|
|
@@ -141,7 +141,7 @@ class Notify
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
-
def zenity(message, title)
|
144
|
+
def self.zenity(message, title)
|
145
145
|
begin
|
146
146
|
@response = `echo "message:#{message}" | zenity --notification --listen`
|
147
147
|
|
data/lib/plugin.rb
CHANGED
data/lib/plugins/workingon.rb
CHANGED
@@ -1,7 +1,21 @@
|
|
1
1
|
module Plugin
|
2
2
|
class WorkingOn
|
3
3
|
def send(message)
|
4
|
-
|
4
|
+
log = File.new('./wo-digest.log')
|
5
|
+
|
6
|
+
open(log, 'a') do |file|
|
7
|
+
file.write("#{message}\n")
|
8
|
+
end
|
9
|
+
|
10
|
+
# enough messages have been stored, send digest
|
11
|
+
if Plugin::num_lines(log) > 3
|
12
|
+
digest = open(log, 'r').read
|
13
|
+
|
14
|
+
Net::HTTP.post_form(URI(sprintf(api_endpoint, api_key)), :task => CGI.escapeHTML(digest.split("\n").uniq.join(', ')))
|
15
|
+
|
16
|
+
# reset digest after sending
|
17
|
+
File.truncate(log, 0)
|
18
|
+
end
|
5
19
|
end
|
6
20
|
|
7
21
|
def api_endpoint
|