ruby-macrodroid 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -1
- data.tar.gz.sig +0 -0
- data/lib/ruby-macrodroid.rb +98 -14
- metadata +23 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f4e1e8fee18ccf4731c38c61f67b673888872ffa5b33349a6f2da8e9e51535f
|
4
|
+
data.tar.gz: a3fe55c967182a61cf50514a38e7c3b8521e3efda4ce93d2b99c41e89540408b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22ec4d0d3b94072c272817def3167dd5b6c8d2874572028bb0f3629dfb0b86e00cbd5779e0f3f99344182819abe556f5ab2440c18621cc50302b35aff40a16bf
|
7
|
+
data.tar.gz: b61d5d2efe7d8e47d1c99438a837f85d25af466c49c34eb3979d7204c600c4ca017262ba3f311311904abb78973713a8f53db9a17b6dce3c802ca8a651cacd21
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
&CQ@��VU俱���̳UP}QG�ɋ�D��-����V���*#E���H�A�6�r"�(��ø�/�y���k��Cd����F��w����O�`0���E8��zހ@��ހ4�A�Đ�4k�"u���[_Q깜L�]
|
2
|
+
|����,zxD"\ݳ�psS��Gv+s�
|
3
|
+
d�oL�ox��`]�&�]d|7�Pe��a��9/�O�n4�
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/ruby-macrodroid.rb
CHANGED
@@ -7,8 +7,58 @@ require 'json'
|
|
7
7
|
require 'uuid'
|
8
8
|
require 'date'
|
9
9
|
require 'rxfhelper'
|
10
|
+
require 'app-routes'
|
10
11
|
|
11
12
|
|
13
|
+
|
14
|
+
class TriggersNlp
|
15
|
+
include AppRoutes
|
16
|
+
|
17
|
+
def initialize()
|
18
|
+
|
19
|
+
super()
|
20
|
+
params = {}
|
21
|
+
triggers(params)
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def triggers(params)
|
26
|
+
|
27
|
+
get /^at (\d+:\d+(?:[ap]m)?) on (.*)/i do |time, days|
|
28
|
+
[TimerTrigger, {time: time, days: days}]
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
alias find_trigger run_route
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
class ActionsNlp
|
39
|
+
include AppRoutes
|
40
|
+
|
41
|
+
def initialize()
|
42
|
+
|
43
|
+
super()
|
44
|
+
params = {}
|
45
|
+
actions(params)
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
def actions(params)
|
50
|
+
|
51
|
+
get /^message popup: (.*)/i do |msg|
|
52
|
+
[ToastAction, {msg: msg}]
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
alias find_action run_route
|
59
|
+
|
60
|
+
end
|
61
|
+
|
12
62
|
module Params
|
13
63
|
|
14
64
|
refine Hash do
|
@@ -155,28 +205,62 @@ class Macro
|
|
155
205
|
|
156
206
|
@name = node.attributes[:name]
|
157
207
|
|
158
|
-
|
159
|
-
@triggers = node.xpath('triggers/*').map do |e|
|
208
|
+
if node.element('triggers') then
|
160
209
|
|
161
|
-
|
162
|
-
{timer: TimerTrigger}[e.name.to_sym].new(e.attributes.to_h)
|
210
|
+
# level 2
|
163
211
|
|
164
|
-
|
212
|
+
# get all the triggers
|
213
|
+
@triggers = node.xpath('triggers/*').map do |e|
|
214
|
+
|
215
|
+
puts 'e.name: ' + e.name.inspect if @debug
|
216
|
+
{timer: TimerTrigger}[e.name.to_sym].new(e.attributes.to_h)
|
217
|
+
|
218
|
+
end
|
165
219
|
|
166
|
-
|
167
|
-
|
220
|
+
# get all the actions
|
221
|
+
@actions = node.xpath('actions/*').map do |e|
|
222
|
+
|
223
|
+
if e.name == 'notification' then
|
224
|
+
|
225
|
+
case e.attributes[:type].to_sym
|
226
|
+
when :popup
|
227
|
+
e.attributes.delete :type
|
228
|
+
ToastAction.new e.attributes.to_h
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
else
|
168
236
|
|
169
|
-
|
237
|
+
# Level 1
|
238
|
+
|
239
|
+
tp = TriggersNlp.new
|
240
|
+
|
241
|
+
@triggers = node.xpath('trigger').map do |e|
|
170
242
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
243
|
+
r = tp.find_trigger e.text
|
244
|
+
|
245
|
+
if r then
|
246
|
+
r[0].new(r[1])
|
175
247
|
end
|
176
248
|
|
177
249
|
end
|
178
|
-
|
179
|
-
|
250
|
+
|
251
|
+
ap = ActionsNlp.new
|
252
|
+
|
253
|
+
@actions = node.xpath('action').map do |e|
|
254
|
+
|
255
|
+
r = ap.find_action e.text
|
256
|
+
|
257
|
+
if r then
|
258
|
+
r[0].new(r[1])
|
259
|
+
end
|
260
|
+
|
261
|
+
end
|
262
|
+
|
263
|
+
end
|
180
264
|
|
181
265
|
self
|
182
266
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-macrodroid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
NZ2kdBIUDnAM24e0/wXdVxg4HnsZbdymxyzMQ4P5pKYcpI6oisBxI37p/Xy+wAg3
|
36
36
|
SBHno3GEuuD8ZWj24IMJpfbp
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-08-
|
38
|
+
date: 2020-08-13 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: uuid
|
@@ -77,6 +77,26 @@ dependencies:
|
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: 0.9.4
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: app-routes
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - "~>"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0.1'
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.1.19
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.1'
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 0.1.19
|
80
100
|
description:
|
81
101
|
email: james@jamesrobertson.eu
|
82
102
|
executables: []
|
@@ -106,5 +126,5 @@ requirements: []
|
|
106
126
|
rubygems_version: 3.0.3
|
107
127
|
signing_key:
|
108
128
|
specification_version: 4
|
109
|
-
summary: '
|
129
|
+
summary: 'A macro builder for MacroDroid. #unofficialgem #experimental'
|
110
130
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|