ruby-macrodroid 0.8.8 → 0.8.9

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: 24d851b05dbc6ecfd52b146846a6bbe935a06d30bfdf523c0550bd18c701b93b
4
- data.tar.gz: 97171c71818bc1d0ce3ed70dc790f3464170e18f8ff62b5b3ff47b66f40c49d0
3
+ metadata.gz: 12fa9c7d9f642140ed62656a4c3444e5c739ad2be06af2883e23e48766cd742f
4
+ data.tar.gz: 6f70e2124afbcf43bd15295dfea8aaf9a0a8d6704de819acb34481082d8c905f
5
5
  SHA512:
6
- metadata.gz: a9187782e93e70a758e50a07c49812d5bb915dab37bb108d174157a76d76cc2b625b766665ad5ac3f47c7d12d3ac8082b291966aa36c114d4d573ddf38e567b3
7
- data.tar.gz: 7514ffbe6a9b4c063fe278c685ce0a860b4d28a1945d4819faa65b081395b701b5dab657a3d7764b87689f230c74d7c14051e563ad4360937ade7f78466ac3a3
6
+ metadata.gz: a00b28e20a41ffbdead956eb07ad4e7fe412aa2ceb773017a709c97a4fd1307672b78405581a8e54d855d1f9cb53fe598638bc542facccde886b127e9e150d17
7
+ data.tar.gz: ddcdc9689a2f202477018ab710772c834caad0e392c6d7135c0f65beb8e85dbf0144fc793e7b11db404531a1cbaf69876b2b21f7598b6baf1361ba794f7bc809
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- \�-��1g(3�&�oԓz7R�,$�ǝ�_gb����
2
- ���;t1ӎ���M��(Y棸����s_��*A���mXl4}Mݩ�{������ꉻ;��
1
+ 0t�����Ip���,���d ��Q7��N��j���eO���Xu�,�{2'���Gi��V'��qͩTȉ����+��)jۥ7 603�e�����OC�O�갣�pR^���¢�Sܥ�̦�t����>������ᚈ�XkBoi��Z��c�O8���q�#a�
2
+ �����L'NK��Dqf�H� k�w�+ԐP]�\�X9��x��w���1wj{S9fWDgc�6s��Yr�= �ų��UB�,�Q.�z�R�R\C���jC��탿Ru�����3����j�a+�������>�tv׳��[��Ѐ�0^
3
+ d[m6��N�eœ�׷�HvLv
@@ -551,7 +551,7 @@ class Macro
551
551
  inner_lines = e.xpath('item/description/text()')
552
552
 
553
553
  action = if e.text.to_s.strip.empty? then
554
- inner_lines.shift
554
+ inner_lines.shift.strip
555
555
  else
556
556
  e.text.strip
557
557
  end
@@ -659,21 +659,63 @@ EOF
659
659
 
660
660
  def to_s(colour: false)
661
661
 
662
- indent = 0
662
+ indent = 0 #@actions.map(&:to_s).join.lines.length > 0 ? 1 : 0
663
+
664
+ a = []
665
+ a << '# ' + @category + "\n" if @category
666
+ a << (colour ? "m".bg_cyan.gray.bold : 'm') + ': ' + @title
667
+
668
+
669
+ if @description and @description.length >= 1 then
670
+ a << (colour ? "d".bg_gray.gray.bold : 'd') + ': ' \
671
+ + @description.gsub(/\n/,"\n ")
672
+ end
673
+
674
+ if @local_variables.length >= 1 then
675
+
676
+ vars = @local_variables.map do |k,v|
677
+ label = colour ? 'v'.bg_magenta : 'v'
678
+ label += ': '
679
+ label + "%s: %s" % [k,v]
680
+ end
681
+
682
+ a << vars.join("\n")
683
+ end
684
+
685
+ a << @triggers.map do |x|
686
+ s =-x.to_s(colour: colour)
687
+
688
+ s2 = if s.lines.length > 1 then
689
+ "\n" + s.lines.map {|x| x.prepend (' ' * (indent+1)) }.join
690
+ else
691
+ ' ' + s
692
+ end
693
+ #s.lines > 1 ? "\n" + x : x
694
+ (colour ? "t".bg_red.gray.bold : 't') + ":" + s2
695
+ end.join("\n")
696
+
663
697
  actions = @actions.map do |x|
664
698
 
699
+
665
700
  s = x.to_s(colour: colour)
666
- if s.lines.length > 1 then
667
- lines = s.lines
668
- s = lines[0] + lines[1..-1].map {|x| x.prepend (' ' * indent) }.join
669
- end
701
+ #puts 's: ' + s.inspect
702
+
703
+
670
704
 
671
705
  r = if indent <= 0 then
672
706
 
707
+ lines = s.lines
708
+
709
+ if lines.length > 1 then
710
+ s = lines.map {|x| x.prepend (' ' * (indent+1)) }.join
711
+ end
712
+
713
+ s2 = s.lines.length > 1 ? "\n" + s : ' ' + s
714
+
673
715
  if colour then
674
- "a".bg_blue.gray.bold + ": %s" % s
716
+ "a".bg_blue.gray.bold + ":" + s2
675
717
  else
676
- "a: %s" % s
718
+ "a:" + s2
677
719
  end
678
720
 
679
721
  elsif indent > 0
@@ -684,7 +726,8 @@ EOF
684
726
  indent -= 1
685
727
  (' ' * indent) + "%s" % s
686
728
  else
687
- (' ' * indent) + "%s" % s
729
+ s2 = s.lines[0] + s.lines[1..-1].map {|x| (' ' * indent) + x }.join
730
+ (' ' * indent) + "%s" % s2
688
731
  end
689
732
 
690
733
  end
@@ -711,29 +754,9 @@ EOF
711
754
 
712
755
  end.join("\n")
713
756
 
714
- a = []
715
- a << '# ' + @category + "\n" if @category
716
- a << (colour ? "m".bg_cyan.gray.bold : 'm') + ': ' + @title
717
757
 
718
758
 
719
- if @description and @description.length >= 1 then
720
- a << (colour ? "d".bg_gray.gray.bold : 'd') + ': ' \
721
- + @description.gsub(/\n/,"\n ")
722
- end
723
-
724
- if @local_variables.length >= 1 then
725
-
726
- vars = @local_variables.map do |k,v|
727
- label = colour ? 'v'.bg_magenta : 'v'
728
- label += ': '
729
- label + "%s: %s" % [k,v]
730
- end
731
-
732
- a << vars.join("\n")
733
- end
734
-
735
- a << @triggers.map {|x| (colour ? "t".bg_red.gray.bold : 't') \
736
- + ": %s" % x}.join("\n")
759
+
737
760
  a << actions
738
761
 
739
762
 
@@ -53,18 +53,6 @@ class Action < MacroObject
53
53
  "%s/%s: %s" % [@group, @type, s]
54
54
  end
55
55
 
56
- def to_s(colour: false, indent: 0)
57
-
58
- h = @h.clone
59
- h.delete :macro
60
- @s ||= "#<%s %s>" % [self.class, h.inspect]
61
- operator = @h[:is_or_condition] ? 'OR' : 'AND'
62
- constraints = @constraints.map \
63
- {|x| ' ' * indent + x.to_summary(colour: colour)}.join(" %s " % operator)
64
-
65
- @s + constraints
66
-
67
- end
68
56
 
69
57
  end
70
58
 
@@ -140,7 +128,7 @@ class LaunchShortcutAction < ApplicationAction
140
128
  end
141
129
 
142
130
  def to_s(colour: false, indent: 0)
143
- @s = "Launch Shortcut: " + @h[:app_name] + "\n " + @h[:name]
131
+ @s = "Launch Shortcut: " + @h[:app_name] + "\n" + @h[:name]
144
132
  super()
145
133
  end
146
134
 
@@ -169,7 +157,8 @@ class OpenWebPageAction < ApplicationAction
169
157
  end
170
158
 
171
159
  def to_s(colour: false, indent: 0)
172
- "HTTP GET\n url: " + @h[:url_to_open]
160
+ @s = "HTTP GET\nurl: " + @h[:url_to_open]
161
+ super()
173
162
  end
174
163
 
175
164
  end
@@ -284,10 +273,20 @@ class LoopAction < Action
284
273
 
285
274
  def to_s(colour: false, indent: 0)
286
275
 
276
+ h = @h.clone
277
+ h.delete :macro
287
278
  @s = 'DO / WHILE '
288
- super()
279
+ operator = @h[:is_or_condition] ? 'OR' : 'AND'
280
+ constraints = @constraints.map \
281
+ {|x| ' ' * indent + x.to_summary(colour: colour)}.join(" %s " % operator)
289
282
 
290
- end
283
+ out = []
284
+ out << "; %s" % @h[:comment] if @h[:comment]
285
+ s = @s.lines.map {|x| (' ' * indent) + x}.join
286
+ out << s + constraints
287
+ out.join("\n")
288
+
289
+ end
291
290
  end
292
291
 
293
292
  # Conditions/Loops
@@ -344,10 +343,20 @@ class IfConditionAction < Action
344
343
 
345
344
  def to_s(colour: false, indent: 0)
346
345
 
347
- @s = "If " #+ @constraints.map(&:to_s).join(" %s " % operator)
348
- super(colour: colour)
346
+ h = @h.clone
347
+ h.delete :macro
348
+ @s = 'If '
349
+ operator = @h[:is_or_condition] ? 'OR' : 'AND'
350
+ constraints = @constraints.map \
351
+ {|x| ' ' * indent + x.to_summary(colour: colour)}.join(" %s " % operator)
349
352
 
350
- end
353
+ out = []
354
+ out << "; %s" % @h[:comment] if @h[:comment]
355
+ s = @s.lines.map {|x| (' ' * indent) + x}.join
356
+ out << s + constraints
357
+ out.join("\n")
358
+
359
+ end
351
360
  end
352
361
 
353
362
  class ElseAction < Action
@@ -383,8 +392,24 @@ class ElseIfConditionAction < Action
383
392
  end
384
393
 
385
394
  def to_s(colour: false, indent: 0)
395
+
396
+ h = @h.clone
397
+ h.delete :macro
386
398
  @s = 'Else If '
387
- super()
399
+ operator = @h[:is_or_condition] ? 'OR' : 'AND'
400
+ constraints = @constraints.map \
401
+ {|x| ' ' * indent + x.to_summary(colour: colour)}.join(" %s " % operator)
402
+
403
+ out = []
404
+ out << "; %s" % @h[:comment] if @h[:comment]
405
+ s = @s.lines.map {|x| (' ' * indent) + x}.join
406
+ out << s + constraints
407
+ out.join("\n")
408
+
409
+ end
410
+
411
+ def to_summary(colour: false)
412
+ 'foo'
388
413
  end
389
414
 
390
415
 
@@ -436,7 +461,7 @@ class SetAirplaneModeAction < ConnectivityAction
436
461
  def to_s(colour: false, indent: 0)
437
462
 
438
463
  state = ['On', 'Off', 'Toggle'][@h[:state]]
439
- @s = 'Airplane Mode ' + state + "\n"
464
+ @s = 'Airplane Mode ' + state
440
465
  super(colour: colour)
441
466
 
442
467
  end
@@ -618,7 +643,10 @@ class StopWatchAction < DateTimeAction
618
643
  end
619
644
 
620
645
  def to_s(colour: false, indent: 0)
621
- 'StopWatchAction ' + @h.inspect
646
+ option = ['Start', 'Pause','Reset','Reset and Restart'][@h[:option]]
647
+ name = @h[:stopwatch_name]
648
+ @s = "StopWatch (%s)" % option + "\n" + name #+ ' ' + @h.inspect
649
+ super()
622
650
  end
623
651
 
624
652
  alias to_summary to_s
@@ -1125,7 +1153,7 @@ class FileOperationV21Action < FileAction
1125
1153
  detail = @h[:from_name]
1126
1154
  detail += ' to: ' + @h[:to_name] if @h[:option] == 1
1127
1155
  @s = "%s %s" % [operation[@h[:option]], file[@h[:file_option]]] \
1128
- + "\n " + detail #+ @h.inspect
1156
+ + "\n" + detail #+ @h.inspect
1129
1157
  super()
1130
1158
  end
1131
1159
 
@@ -1244,7 +1272,7 @@ class ShareLocationAction < LocationAction
1244
1272
  end
1245
1273
 
1246
1274
  def to_s(colour: false, indent: 0)
1247
- @s = 'Share Location' + "\n GPS" # + @h.inspect
1275
+ @s = 'Share Location' + "\nGPS" # + @h.inspect
1248
1276
  super()
1249
1277
  end
1250
1278
 
@@ -1360,6 +1388,31 @@ class ClearLogAction < LoggingAction
1360
1388
  alias to_summary to_s
1361
1389
  end
1362
1390
 
1391
+
1392
+ # MacroDroid Specific
1393
+ #
1394
+ class CancelActiveMacroAction < Action
1395
+
1396
+ def initialize(h={})
1397
+
1398
+ options = {
1399
+
1400
+ }
1401
+
1402
+ super(h)
1403
+
1404
+ end
1405
+
1406
+ def to_s(colour: false, indent: 0)
1407
+ @s = 'Cancel Macro Actions' + "\n " + @h[:macro_name] #+ ' ' + @h.inspect
1408
+ super()
1409
+
1410
+ end
1411
+
1412
+ alias to_summary to_s
1413
+
1414
+ end
1415
+
1363
1416
  # MacroDroid Specific
1364
1417
  #
1365
1418
  class ConfirmNextAction < Action
@@ -1377,7 +1430,7 @@ class ConfirmNextAction < Action
1377
1430
 
1378
1431
  def to_s(colour: false, indent: 0)
1379
1432
 
1380
- @s = 'Confirm Next' + "\n %s: %s" % [@h[:title], @h[:message]]
1433
+ @s = 'Confirm Next' + "\n%s: %s" % [@h[:title], @h[:message]]
1381
1434
  super()
1382
1435
 
1383
1436
  end
@@ -1461,7 +1514,7 @@ class SetVariableAction < Action
1461
1514
 
1462
1515
  end
1463
1516
 
1464
- @s = 'Set Variable' + ("\n %s: " % @h[:variable][:name]) + input #+ @h.inspect
1517
+ @s = 'Set Variable' + ("\n%s: " % @h[:variable][:name]) + input #+ @h.inspect
1465
1518
  super()
1466
1519
 
1467
1520
  end
@@ -1632,7 +1685,7 @@ class SendEmailAction < MessagingAction
1632
1685
 
1633
1686
  def to_s(colour: false, indent: 0)
1634
1687
  recipient = @h[:email_address]
1635
- @s = 'Send EmailAction' + "\n To: " + recipient #+ ' ' + @h.inspect
1688
+ @s = 'Send EmailAction' + "\nTo: " + recipient #+ ' ' + @h.inspect
1636
1689
  super()
1637
1690
  end
1638
1691
 
@@ -1707,7 +1760,7 @@ class ClearNotificationsAction < NotificationsAction
1707
1760
  options = {
1708
1761
  package_name_list: [],
1709
1762
  match_text: '',
1710
- application_name_list: [],
1763
+ application_name_list: [],
1711
1764
  clear_persistent: false,
1712
1765
  excludes: false,
1713
1766
  match_option: 0,
@@ -1870,8 +1923,9 @@ class NotificationAction < NotificationsAction
1870
1923
  end
1871
1924
 
1872
1925
  def to_s(colour: false, indent: 0)
1873
- "Display Notification\n " + \
1926
+ @s = "Display Notification\n" + \
1874
1927
  "%s: %s" % [@h[:notification_subject], @h[:notification_text]]
1928
+ super()
1875
1929
  end
1876
1930
 
1877
1931
  end
@@ -1917,7 +1971,8 @@ class ToastAction < NotificationsAction
1917
1971
  end
1918
1972
 
1919
1973
  def to_s(colour: false, indent: 0)
1920
- @s = "Popup Message\n %s" % @h[:message_text]
1974
+ @s = "Popup Message\n%s" % @h[:message_text]
1975
+ super()
1921
1976
  end
1922
1977
 
1923
1978
  end
@@ -1947,7 +2002,7 @@ class AnswerCallAction < PhoneAction
1947
2002
  end
1948
2003
 
1949
2004
  def to_s(colour: false, indent: 0)
1950
- @s = 'Answer Call' + "\n "
2005
+ @s = 'Answer Call'
1951
2006
  super()
1952
2007
  end
1953
2008
  end
@@ -2009,7 +2064,7 @@ class RejectCallAction < PhoneAction
2009
2064
  end
2010
2065
 
2011
2066
  def to_s(colour: false, indent: 0)
2012
- @s = 'Call Reject' + "\n "
2067
+ @s = 'Call Reject'
2013
2068
  super()
2014
2069
  end
2015
2070
 
@@ -2085,7 +2140,9 @@ class SetBrightnessAction < ScreenAction
2085
2140
  end
2086
2141
 
2087
2142
  def to_s(colour: false, indent: 0)
2088
- 'SetBrightnessAction ' + @h.inspect
2143
+ val = @h[:brightness_percent] > 100 ? 'Auto' : @h[:brightness_percent].to_s + '%'
2144
+ @s = 'Brightness' + "\n " + val #@h.inspect
2145
+ super()
2089
2146
  end
2090
2147
 
2091
2148
  alias to_summary to_s
@@ -2135,7 +2192,8 @@ class ScreenOnAction < ScreenAction
2135
2192
  state += ' ' + 'No Lock (root only)' if @h[:screen_off_no_lock]
2136
2193
  #state += ' ' + '(Alternative)' if @h[:screen_on_alternative]
2137
2194
 
2138
- 'Screen ' + state
2195
+ @s = 'Screen ' + state
2196
+ super()
2139
2197
 
2140
2198
  end
2141
2199
 
@@ -2290,7 +2348,7 @@ class SetVibrateAction < VolumeAction
2290
2348
  ]
2291
2349
 
2292
2350
  status = a[@h[:option_int]]
2293
- @s = 'Vibrate Enable/Disable ' + "\n " + status + "\n "
2351
+ @s = 'Vibrate Enable/Disable ' + "\n" + status
2294
2352
  super()
2295
2353
 
2296
2354
  end
@@ -54,16 +54,30 @@ class MacroObject
54
54
  @h[:siguid]
55
55
  end
56
56
 
57
- def to_s(colour: false)
58
-
57
+ def to_s(colour: false, indent: 0)
58
+
59
59
  h = @h.clone
60
60
  h.delete :macro
61
61
  @s ||= "#<%s %s>" % [self.class, h.inspect]
62
62
  operator = @h[:is_or_condition] ? 'OR' : 'AND'
63
63
  constraints = @constraints.map \
64
- {|x| x.to_summary(colour: colour)}.join(" %s " % operator)
64
+ {|x| 'c: ' + x.to_summary(colour: colour)}
65
+
66
+ out = []
67
+ out << "; %s" % @h[:comment] if @h[:comment] and @h[:comment].length > 1
68
+ #s = @s.lines.map {|x| 'x' + x}.join
69
+
70
+ lines = @s.lines
71
+
72
+ if lines.length > 1 then
73
+ s = lines[0] + lines[1..-1].map {|x| x.prepend (' ' * (indent+1)) }.join
74
+ else
75
+ s = @s
76
+ end
65
77
 
66
- @s + constraints
78
+ out << s
79
+ out += constraints
80
+ out.join("\n")
67
81
 
68
82
  end
69
83
 
@@ -58,9 +58,9 @@ class Trigger < MacroObject
58
58
  @s ||= "#<%s %s>" % [self.class, h.inspect]
59
59
  operator = @h[:is_or_condition] ? 'OR' : 'AND'
60
60
  constraints = @constraints.map \
61
- {|x| x.to_summary(colour: colour, indent: 1)}.join(" %s " % operator)
61
+ {|x| 'c: ' + x.to_summary(colour: colour, indent: 1)}.join(" %s " % operator)
62
62
 
63
- @constraints.any? ? @s + "\n " + constraints : @s
63
+ @constraints.any? ? @s + "\n" + constraints : @s
64
64
 
65
65
  end
66
66
 
@@ -1152,7 +1152,7 @@ class NotificationTrigger < DeviceEventsTrigger
1152
1152
 
1153
1153
  def to_s(colour: false)
1154
1154
  s = (@h[:package_name_list] + @h[:application_name_list]).uniq.join(', ')
1155
- 'Notification Received ' + "\n Any Content (%s)" % s
1155
+ 'Notification Received ' + "\n Any Content (%s)" % s
1156
1156
  end
1157
1157
 
1158
1158
  alias to_summary to_s
@@ -1427,6 +1427,10 @@ class ShakeDeviceTrigger < SensorsTrigger
1427
1427
  def to_s(colour: false)
1428
1428
  'Shake Device'
1429
1429
  end
1430
+
1431
+ def to_summary(colour: false)
1432
+ 'Shake Device'
1433
+ end
1430
1434
 
1431
1435
  end
1432
1436
 
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.8
4
+ version: 0.8.9
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-21 00:00:00.000000000 Z
38
+ date: 2020-09-25 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: glw
metadata.gz.sig CHANGED
Binary file