ruby-macrodroid 0.8.2 → 0.8.3
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 +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ruby-macrodroid.rb +46 -16
- data/lib/ruby-macrodroid/actions.rb +66 -2
- data/lib/ruby-macrodroid/base.rb +1 -0
- data/lib/ruby-macrodroid/triggers.rb +25 -1
- metadata +2 -2
- 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: e6919ccb93fa24e2066b29fd8c2af5bee9dd8cb2fb352cac56cd32261dac0f07
|
4
|
+
data.tar.gz: 6b49954b2ee422b97a7bad61e9498d07930a50e700df82e378f3b5064edb1684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5010ad12e0dc37b2d908a0208615dcf530f2b50775f308c76b738f76fc9e714917e99d7436ef2b72898d4fbb9b1c9774a7a99eac2e486ea1bb4cb704146db33
|
7
|
+
data.tar.gz: f0dd6e92e2ec3421eecce5fc7e36e50c92899974d3fc61d734fbab5782bad7f67c9aaab8bbea4c3f8f8c07bf0efe702e3c37a6836a934c5634eff8521dff8737
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/ruby-macrodroid.rb
CHANGED
@@ -248,11 +248,7 @@ class ActionsNlp
|
|
248
248
|
|
249
249
|
alias find_action run_route
|
250
250
|
|
251
|
-
def to_s(colour: false)
|
252
|
-
'ActionsNlp ' + @h.inspect
|
253
|
-
end
|
254
251
|
|
255
|
-
alias to_summary to_s
|
256
252
|
end
|
257
253
|
|
258
254
|
class ConstraintsNlp
|
@@ -333,6 +329,7 @@ module Params
|
|
333
329
|
end
|
334
330
|
|
335
331
|
|
332
|
+
|
336
333
|
class Macro
|
337
334
|
using ColouredText
|
338
335
|
using Params
|
@@ -406,7 +403,25 @@ class Macro
|
|
406
403
|
@description = h[:description]
|
407
404
|
|
408
405
|
# fetch the local variables
|
409
|
-
|
406
|
+
if h[:local_variables].any? and h[:local_variables].first.any? then
|
407
|
+
|
408
|
+
@local_variables = h[:local_variables].map do |var|
|
409
|
+
|
410
|
+
val = case var[:type]
|
411
|
+
when 0 # boolean
|
412
|
+
var[:boolean_value]
|
413
|
+
when 1 # integer
|
414
|
+
var[:int_value]
|
415
|
+
when 2 # string
|
416
|
+
var[:string_value]
|
417
|
+
when 3 # decimal
|
418
|
+
var[:decimal_Value]
|
419
|
+
end
|
420
|
+
|
421
|
+
[var[:name], val]
|
422
|
+
|
423
|
+
end.to_h
|
424
|
+
end
|
410
425
|
|
411
426
|
# fetch the triggers
|
412
427
|
@triggers = h[:trigger_list].map do |trigger|
|
@@ -634,7 +649,7 @@ EOF
|
|
634
649
|
|
635
650
|
end
|
636
651
|
|
637
|
-
if s =~ /^If/i then
|
652
|
+
if s =~ /^(?:If|WHILE \/ DO)/i then
|
638
653
|
|
639
654
|
if indent < 1 then
|
640
655
|
|
@@ -657,22 +672,39 @@ EOF
|
|
657
672
|
end.join("\n")
|
658
673
|
|
659
674
|
a = [
|
660
|
-
(colour ? "m".bg_cyan.gray.bold : 'm') + ': ' + @title
|
661
|
-
@triggers.map {|x| (colour ? "t".bg_red.gray.bold : 't') \
|
662
|
-
+ ": %s" % x}.join("\n"),
|
663
|
-
actions
|
675
|
+
(colour ? "m".bg_cyan.gray.bold : 'm') + ': ' + @title
|
664
676
|
]
|
665
677
|
|
678
|
+
if @description and @description.length >= 1 then
|
679
|
+
a << (colour ? "d".bg_gray.gray.bold : 'd') + ': ' \
|
680
|
+
+ @description.gsub(/\n/,"\n ")
|
681
|
+
end
|
682
|
+
|
683
|
+
if @local_variables.length >= 1 then
|
684
|
+
|
685
|
+
vars = @local_variables.map do |k,v|
|
686
|
+
label = colour ? 'v'.bg_magenta : 'v'
|
687
|
+
label += ': '
|
688
|
+
label + "%s: %s" % [k,v]
|
689
|
+
end
|
690
|
+
|
691
|
+
a << vars.join("\n")
|
692
|
+
end
|
693
|
+
|
694
|
+
a << @triggers.map {|x| (colour ? "t".bg_red.gray.bold : 't') \
|
695
|
+
+ ": %s" % x}.join("\n")
|
696
|
+
a << actions
|
697
|
+
|
698
|
+
|
666
699
|
if @constraints.any? then
|
667
700
|
a << @constraints.map do |x|
|
668
701
|
(colour ? "c".bg_green.gray.bold : 'c') + ": %s" % x
|
669
702
|
end.join("\n")
|
670
703
|
end
|
671
704
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
end
|
705
|
+
|
706
|
+
|
707
|
+
|
676
708
|
|
677
709
|
a.join("\n") + "\n"
|
678
710
|
|
@@ -745,8 +777,6 @@ EOF
|
|
745
777
|
end
|
746
778
|
|
747
779
|
|
748
|
-
|
749
|
-
|
750
780
|
class MacroDroidError < Exception
|
751
781
|
end
|
752
782
|
|
@@ -272,6 +272,60 @@ class TakePictureAction < CameraAction
|
|
272
272
|
|
273
273
|
end
|
274
274
|
|
275
|
+
|
276
|
+
# Conditions/Loops
|
277
|
+
#
|
278
|
+
class LoopAction < Action
|
279
|
+
|
280
|
+
def initialize(h={})
|
281
|
+
|
282
|
+
options = {
|
283
|
+
|
284
|
+
}
|
285
|
+
|
286
|
+
h2 = options.merge(h)
|
287
|
+
|
288
|
+
super(h2)
|
289
|
+
|
290
|
+
@label = 'WHILE / DO '
|
291
|
+
|
292
|
+
end
|
293
|
+
|
294
|
+
def to_s(colour: false)
|
295
|
+
|
296
|
+
@s = 'WHILE / DO '
|
297
|
+
super()
|
298
|
+
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
# Conditions/Loops
|
303
|
+
#
|
304
|
+
class EndLoopAction < Action
|
305
|
+
|
306
|
+
def initialize(h={})
|
307
|
+
|
308
|
+
options = {
|
309
|
+
|
310
|
+
}
|
311
|
+
|
312
|
+
h2 = options.merge(h)
|
313
|
+
|
314
|
+
super(h2)
|
315
|
+
|
316
|
+
@label = 'End Loop '
|
317
|
+
|
318
|
+
end
|
319
|
+
|
320
|
+
def to_s(colour: false)
|
321
|
+
|
322
|
+
'End Loop '
|
323
|
+
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
# Conditions/Loops
|
328
|
+
#
|
275
329
|
class IfConditionAction < Action
|
276
330
|
|
277
331
|
def initialize(h={})
|
@@ -317,7 +371,7 @@ class ElseAction < Action
|
|
317
371
|
|
318
372
|
end
|
319
373
|
|
320
|
-
class ElseIfConditionAction <
|
374
|
+
class ElseIfConditionAction < Action
|
321
375
|
|
322
376
|
def initialize(h={})
|
323
377
|
|
@@ -326,9 +380,14 @@ class ElseIfConditionAction < IfConditionAction
|
|
326
380
|
}
|
327
381
|
|
328
382
|
super(options.merge h)
|
329
|
-
@label = '
|
383
|
+
@label = 'Else If '
|
330
384
|
|
331
385
|
end
|
386
|
+
|
387
|
+
def to_s(colour: false)
|
388
|
+
@s = 'Else If '
|
389
|
+
super()
|
390
|
+
end
|
332
391
|
|
333
392
|
|
334
393
|
end
|
@@ -793,6 +852,11 @@ end
|
|
793
852
|
#
|
794
853
|
class CameraFlashLightAction < DeviceSettingsAction
|
795
854
|
|
855
|
+
# options
|
856
|
+
# 0 Toch On
|
857
|
+
# 1 Torch Off
|
858
|
+
# 2 Torch Toggle
|
859
|
+
#
|
796
860
|
def initialize(h={})
|
797
861
|
|
798
862
|
options = {
|
data/lib/ruby-macrodroid/base.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# file: ruby-macrodroid/
|
1
|
+
# file: ruby-macrodroid/triggers.rb
|
2
2
|
|
3
3
|
# This file contains the following classes:
|
4
4
|
#
|
@@ -26,6 +26,8 @@
|
|
26
26
|
#
|
27
27
|
|
28
28
|
|
29
|
+
|
30
|
+
|
29
31
|
class Trigger < MacroObject
|
30
32
|
using Params
|
31
33
|
|
@@ -971,6 +973,28 @@ class MusicPlayingTrigger < DeviceEventsTrigger
|
|
971
973
|
end
|
972
974
|
|
973
975
|
|
976
|
+
# Category: Device Events
|
977
|
+
#
|
978
|
+
class NFCTrigger < DeviceEventsTrigger
|
979
|
+
|
980
|
+
def initialize(h={})
|
981
|
+
|
982
|
+
options = {
|
983
|
+
}
|
984
|
+
|
985
|
+
super(options.merge h)
|
986
|
+
|
987
|
+
end
|
988
|
+
|
989
|
+
def to_s(colour: false)
|
990
|
+
'NFC Tag' + "\n " + @h[:tag_name]
|
991
|
+
end
|
992
|
+
|
993
|
+
alias to_summary to_s
|
994
|
+
|
995
|
+
end
|
996
|
+
|
997
|
+
|
974
998
|
# Category: Device Events
|
975
999
|
#
|
976
1000
|
class DeviceUnlockedTrigger < DeviceEventsTrigger
|
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.8.
|
4
|
+
version: 0.8.3
|
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-09-
|
38
|
+
date: 2020-09-16 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: glw
|
metadata.gz.sig
CHANGED
Binary file
|