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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d741e63df502364d934438221160e20d967303ec5c79923924e7c978175f44d
4
- data.tar.gz: 9b0e372bb0cfc60ddcd553355bc30dbb90cdd303904c93556a8f16ef87fb2432
3
+ metadata.gz: 5f4e1e8fee18ccf4731c38c61f67b673888872ffa5b33349a6f2da8e9e51535f
4
+ data.tar.gz: a3fe55c967182a61cf50514a38e7c3b8521e3efda4ce93d2b99c41e89540408b
5
5
  SHA512:
6
- metadata.gz: 40c3507258eade1847ea92c63912f930db4c3843e36beec011e9b9fbaf5fbbc47ea9d8778aaaf7b43be9486ce63875116433065a007dd6956112128c1d96aa0f
7
- data.tar.gz: dff690f4ce9ebb274cc22f99c95f18981ab05136597a2b0c0eabdf9fa6848c004d2003b653b280da147302aec651731952b8d3c5077222bfc625d4e3819b0008
6
+ metadata.gz: 22ec4d0d3b94072c272817def3167dd5b6c8d2874572028bb0f3629dfb0b86e00cbd5779e0f3f99344182819abe556f5ab2440c18621cc50302b35aff40a16bf
7
+ data.tar.gz: b61d5d2efe7d8e47d1c99438a837f85d25af466c49c34eb3979d7204c600c4ca017262ba3f311311904abb78973713a8f53db9a17b6dce3c802ca8a651cacd21
@@ -1 +1,3 @@
1
- a��ũt�w��Т��|�<���3u����P���ɞ�0���.�D��4a�H��@�qh�l<��x?J]���O_���/UӇ���0+i�`�dy�|Q{$eb@���n3s�Yx_��<��E���MWֿ l?��AmҬzz�U"��A⷏��g|֕�� ���/�9x*������2},yzzh�LY*�;to-n�lnn<���1�~ww DEm�ҥxu�|�O�-��:[�y�# �k�x{�yr���RD�z���B2Ou.o��m���.Ih=�� �v<u�=0�g��T�V��G[���h(��1fIy�r�R1?LKO�Ppf3�0�xi��M�$ �E�\ ��ܷ/����ZY���&Z�=u!S�D
1
+ &CQ@��VU俱���̳UP}QG�ɋ�D��-����V�򿱉��*#E���H�A6r"�(��ø�/�y���k��Cd����F��w����O�`0���E8��zހ@��ހ4A�Đ�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
@@ -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
- # get all the triggers
159
- @triggers = node.xpath('triggers/*').map do |e|
208
+ if node.element('triggers') then
160
209
 
161
- puts 'e.name: ' + e.name.inspect if @debug
162
- {timer: TimerTrigger}[e.name.to_sym].new(e.attributes.to_h)
210
+ # level 2
163
211
 
164
- end
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
- # get all the actions
167
- @actions = node.xpath('actions/*').map do |e|
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
- if e.name == 'notification' then
237
+ # Level 1
238
+
239
+ tp = TriggersNlp.new
240
+
241
+ @triggers = node.xpath('trigger').map do |e|
170
242
 
171
- case e.attributes[:type].to_sym
172
- when :popup
173
- e.attributes.delete :type
174
- ToastAction.new e.attributes.to_h
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
- end
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.2.2
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-12 00:00:00.000000000 Z
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: 'Reads the exported JSON file from MacroDroid. #unofficialgem #experimental'
129
+ summary: 'A macro builder for MacroDroid. #unofficialgem #experimental'
110
130
  test_files: []
metadata.gz.sig CHANGED
Binary file