notifaction 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/lib/notifaction.rb +7 -0
- data/lib/notify.rb +23 -10
- data/lib/plugin.rb +5 -0
- data/lib/plugins/workingon.rb +5 -1
- data/lib/utils.rb +0 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3e0679b219058befb39070d0e4f2fa4bb07deb2
|
4
|
+
data.tar.gz: 77d81a4e23b84e7b10e1ac5b22df25294f16d1d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 906af35271e9cc86683203c3f9aee97e0e85958f094309242564c46effa619fe85c6ce1bf6680161b1f1d37b94444d3353ba828caca5ce556b5ab2750a0aec08
|
7
|
+
data.tar.gz: 159c6d79f20af9ff4d8accfcaad98e91ba95e3f5e9ce1942cc7642fe392436eb5277d746155e7e4fc20528e6108f8c3b259c5a2ef1023ae977865b31b1a68b8c
|
data/lib/notifaction.rb
CHANGED
data/lib/notify.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
$:.unshift File.dirname(__FILE__)
|
2
|
-
|
3
1
|
class Notify
|
4
2
|
# Display a notification bubble
|
5
3
|
def self.bubble(message, title)
|
@@ -70,10 +68,8 @@ class Notify
|
|
70
68
|
end
|
71
69
|
|
72
70
|
# Send status updates to WorkingOn
|
73
|
-
def self.
|
71
|
+
def self.workingon(message, print_info_message = false)
|
74
72
|
begin
|
75
|
-
require_relative "plugins/workingon.rb"
|
76
|
-
|
77
73
|
plugin = Plugin::WorkingOn.new
|
78
74
|
plugin.send(message)
|
79
75
|
|
@@ -81,7 +77,7 @@ class Notify
|
|
81
77
|
info(message)
|
82
78
|
end
|
83
79
|
rescue Exception => e
|
84
|
-
error("Error notifying WO - #{e.message}"
|
80
|
+
error("Error notifying WO - #{e.message}")
|
85
81
|
end
|
86
82
|
end
|
87
83
|
|
@@ -90,6 +86,23 @@ class Notify
|
|
90
86
|
inline("\u2011 =============", :magenta)
|
91
87
|
end
|
92
88
|
|
89
|
+
def self.configure
|
90
|
+
yield self if block_given?
|
91
|
+
end
|
92
|
+
|
93
|
+
# register new plugins
|
94
|
+
def self.plugins=(plugin_config_arr)
|
95
|
+
plugin_config_arr.each do |hash|
|
96
|
+
hash.each_pair do |plugin, key|
|
97
|
+
# include the requested plugin
|
98
|
+
require_relative "plugins/#{plugin.downcase}.rb"
|
99
|
+
|
100
|
+
plugin_instance = Plugin.const_get(plugin.to_sym).new
|
101
|
+
instance_variable_set("@#{plugin}_key".to_sym, key)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
93
106
|
private
|
94
107
|
# Collate colour and style, build message string in format of
|
95
108
|
# "\e[#{style};#{colour}m#{text}\e[0m"
|
@@ -103,7 +116,7 @@ class Notify
|
|
103
116
|
|
104
117
|
$?.exitstatus == 0
|
105
118
|
rescue SystemExit, Interrupt
|
106
|
-
error("Interrupt caught, exiting"
|
119
|
+
error("Interrupt caught, exiting")
|
107
120
|
end
|
108
121
|
end
|
109
122
|
|
@@ -114,7 +127,7 @@ class Notify
|
|
114
127
|
|
115
128
|
$?.exitstatus == 0
|
116
129
|
rescue SystemExit, Interrupt
|
117
|
-
error("Interrupt caught, exiting"
|
130
|
+
error("Interrupt caught, exiting")
|
118
131
|
end
|
119
132
|
end
|
120
133
|
|
@@ -125,7 +138,7 @@ class Notify
|
|
125
138
|
|
126
139
|
$?.exitstatus == 0
|
127
140
|
rescue SystemExit, Interrupt
|
128
|
-
error("Interrupt caught, exiting"
|
141
|
+
error("Interrupt caught, exiting")
|
129
142
|
end
|
130
143
|
end
|
131
144
|
|
@@ -135,7 +148,7 @@ class Notify
|
|
135
148
|
|
136
149
|
$?.exitstatus == 0
|
137
150
|
rescue SystemExit, Interrupt
|
138
|
-
error("Interrupt caught, exiting"
|
151
|
+
error("Interrupt caught, exiting")
|
139
152
|
end
|
140
153
|
end
|
141
154
|
end
|
data/lib/plugins/workingon.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
module Plugin
|
2
2
|
class WorkingOn
|
3
3
|
def send(message)
|
4
|
-
Net::HTTP.post_form(URI(sprintf(api_endpoint,
|
4
|
+
::Net::HTTP.post_form(URI(sprintf(api_endpoint, api_key)), :task => CGI.escapeHTML(message))
|
5
5
|
end
|
6
6
|
|
7
7
|
def api_endpoint
|
8
8
|
"https://api.workingon.co/hooks/incoming?token=%s"
|
9
9
|
end
|
10
|
+
|
11
|
+
def api_key
|
12
|
+
Notify.instance_variable_get('@WorkingOn_key')
|
13
|
+
end
|
10
14
|
end
|
11
15
|
end
|
data/lib/utils.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifaction
|
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
|
- Ryan Priebe
|
@@ -17,10 +17,11 @@ extensions: []
|
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
19
|
- lib/notifaction.rb
|
20
|
-
- lib/utils.rb
|
21
20
|
- lib/notify.rb
|
22
|
-
- lib/
|
21
|
+
- lib/plugin.rb
|
23
22
|
- lib/plugins/workingon.rb
|
23
|
+
- lib/style.rb
|
24
|
+
- lib/utils.rb
|
24
25
|
homepage: http://rubygems.org/gems/notifaction
|
25
26
|
licenses:
|
26
27
|
- MIT
|