ruby-macrodroid 0.8.3 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6919ccb93fa24e2066b29fd8c2af5bee9dd8cb2fb352cac56cd32261dac0f07
4
- data.tar.gz: 6b49954b2ee422b97a7bad61e9498d07930a50e700df82e378f3b5064edb1684
3
+ metadata.gz: e37f4ab29dcdcd4c347d15cefb087663679ec7859094f94dc50a39dd66799b85
4
+ data.tar.gz: 26896b3fdea9e794467abdd41e4898d80ff240c9464316e09513db2d6b7956f2
5
5
  SHA512:
6
- metadata.gz: a5010ad12e0dc37b2d908a0208615dcf530f2b50775f308c76b738f76fc9e714917e99d7436ef2b72898d4fbb9b1c9774a7a99eac2e486ea1bb4cb704146db33
7
- data.tar.gz: f0dd6e92e2ec3421eecce5fc7e36e50c92899974d3fc61d734fbab5782bad7f67c9aaab8bbea4c3f8f8c07bf0efe702e3c37a6836a934c5634eff8521dff8737
6
+ metadata.gz: 3f7da291c314b2cd03ac2704ea3c1fbd2380f7a85389747b559cc1e5106499f71d120ba935ee73f6078978744abd1f20d16cad941bbac597746769e83c2954df
7
+ data.tar.gz: 8bae5ed2da5e357335f9720746b5bca7358e0a134fc8cf64b8fd5fcc8fc780137d2d4ae20baf2568f8771a467c283d16dc6fd0fa3dddf4cb7cdcd3927c4ff0d7
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -154,6 +154,16 @@ class ActionsNlp
154
154
  [ToastAction, {msg: msg}]
155
155
  end
156
156
 
157
+ # e.g. Popup Message\n hello world!
158
+ get /^Popup Message\n\s+(.*)/im do |msg|
159
+ [ToastAction, {msg: msg}]
160
+ end
161
+
162
+ # e.g. Popup Message
163
+ get /^Popup Message$/i do
164
+ [ToastAction, {}]
165
+ end
166
+
157
167
  # e.g. say current time
158
168
  get /^say current[ _]time/i do
159
169
  [SayTimeAction, {}]
@@ -528,20 +538,33 @@ class Macro
528
538
  @actions = node.xpath('action').map do |e|
529
539
 
530
540
  puts 'action e: ' + e.xml.inspect if @debug
531
- r = ap.find_action e.text
541
+ puts 'e.text ' + e.text if @debug
542
+ r = ap.find_action e.text.strip
532
543
  puts 'found action ' + r.inspect if @debug
533
544
 
534
545
  if r then
535
546
 
536
- a = e.xpath('item/*')
547
+ loose = e.element('item/description/text()')
548
+
549
+ raw_attributes = if loose then
537
550
 
538
- h = if a.any? then
539
- a.map {|node| [node.name.to_sym, node.text.to_s]}.to_h
551
+ puts 'do something ' + loose.to_s
552
+ loose.to_s
553
+
540
554
  else
541
- {}
555
+
556
+ a = e.xpath('item/*')
557
+
558
+ h = if a.any? then
559
+ a.map {|node| [node.name.to_sym, node.text.to_s]}.to_h
560
+ else
561
+ {}
562
+ end
563
+
564
+ r[1].merge(h)
565
+
542
566
  end
543
-
544
- r[0].new(r[1].merge(h))
567
+ r[0].new(raw_attributes)
545
568
  end
546
569
 
547
570
  end
@@ -273,6 +273,34 @@ class TakePictureAction < CameraAction
273
273
  end
274
274
 
275
275
 
276
+ # Conditions/Loops
277
+ #
278
+ class IfConfirmedThenAction < Action
279
+
280
+ def initialize(h={})
281
+
282
+ options = {
283
+ a: true,
284
+ constraint_list: ''
285
+ }
286
+
287
+ macro = h[:macro]
288
+ h2 = options.merge(filter(options,h).merge(macro: macro))
289
+
290
+ super(h2)
291
+
292
+ @label = 'If Confirmed Then '
293
+
294
+ end
295
+
296
+ def to_s(colour: false)
297
+
298
+ @s = "If Confirmed Then " #+ @constraints.map(&:to_s).join(" %s " % operator)
299
+ super(colour: colour)
300
+
301
+ end
302
+ end
303
+
276
304
  # Conditions/Loops
277
305
  #
278
306
  class LoopAction < Action
@@ -702,7 +730,7 @@ class ClipboardAction < DeviceAction
702
730
  end
703
731
 
704
732
  def to_s(colour: false)
705
- 'ClipboardAction ' + @h.inspect
733
+ 'Fill Clipboard' + "\n " + @h[:clipboard_text] #+ @h.inspect
706
734
  end
707
735
 
708
736
  alias to_summary to_s
@@ -1090,6 +1118,30 @@ class OpenFileAction < FileAction
1090
1118
  end
1091
1119
 
1092
1120
 
1121
+ # Category: Files
1122
+ #
1123
+ class WriteToFileAction < FileAction
1124
+
1125
+ def initialize(h={})
1126
+
1127
+ options = {
1128
+ app_name: '',
1129
+ class_name: '',
1130
+ package_name: '',
1131
+ file_path: ''
1132
+ }
1133
+
1134
+ super(options.merge h)
1135
+
1136
+ end
1137
+
1138
+ def to_s(colour: false)
1139
+ 'Write To File' + "\n " + @h[:filename] #+ @h.inspect
1140
+ end
1141
+
1142
+ alias to_summary to_s
1143
+ end
1144
+
1093
1145
  class LocationAction < Action
1094
1146
 
1095
1147
  def initialize(h={})
@@ -1275,6 +1327,101 @@ class ExportMacrosAction < Action
1275
1327
 
1276
1328
  end
1277
1329
 
1330
+
1331
+ # MacroDroid Specific
1332
+ #
1333
+ class SetVariableAction < Action
1334
+
1335
+ def initialize(h={})
1336
+
1337
+ options = {
1338
+ :user_prompt=>true,
1339
+ :user_prompt_message=>"Please enter a word to see it reversed",
1340
+ :user_prompt_show_cancel=>true,
1341
+ :user_prompt_stop_after_cancel=>true,
1342
+ :user_prompt_title=>"Word reverse",
1343
+ :name => 'word'
1344
+ }
1345
+ super(h)
1346
+
1347
+ end
1348
+
1349
+ def to_s(colour: false)
1350
+
1351
+ input = if @h[:user_prompt] then
1352
+ '[User Prompt]'
1353
+ elsif @h[:expression]
1354
+ @h[:expression]
1355
+ elsif @h[:int_value_increment]
1356
+ '(+1)'
1357
+ elsif @h[:int_value_decrement]
1358
+ '(-1)'
1359
+ elsif @h[:int_random]
1360
+ "Random %d -> %d" % [@h[:int_random_min], @h[:int_random_max]]
1361
+ else
1362
+
1363
+ =begin
1364
+ sym = case @h[:variable][:type]
1365
+ when 0 # boolean
1366
+ :new_boolean_value
1367
+ when 1 # integer
1368
+ :new_int_value
1369
+ when 2 # string
1370
+ :new_string_value
1371
+ when 3 # decimal
1372
+ :new_double_value
1373
+ end
1374
+
1375
+ @h[sym].to_s
1376
+ =end
1377
+ a = %i(new_boolean_value new_int_value new_string_value new_double_value)
1378
+ @h[a[@h[:variable][:type]]].to_s
1379
+
1380
+ end
1381
+
1382
+ @s = 'Set Variable' + ("\n %s: " % @h[:variable][:name]) + input #+ @h.inspect
1383
+ super()
1384
+
1385
+ end
1386
+
1387
+ alias to_summary to_s
1388
+
1389
+ end
1390
+
1391
+
1392
+
1393
+ # MacroDroid Specific
1394
+ #
1395
+ class TextManipulationAction < Action
1396
+
1397
+ def initialize(h={})
1398
+
1399
+ options = {
1400
+
1401
+ }
1402
+ super(h)
1403
+
1404
+ end
1405
+
1406
+ def to_s(colour: false)
1407
+
1408
+ tm = @h[:text_manipulation]
1409
+
1410
+ s = case tm[:type].to_sym
1411
+ when :SubstringManipulation
1412
+ "Substring(%s, %s)" % [@h[:text], tm[:params].join(', ')]
1413
+ end
1414
+
1415
+
1416
+ 'Text Manipulation' + "\n " + s #+ ' ' + @h.inspect
1417
+
1418
+
1419
+ end
1420
+
1421
+ alias to_summary to_s
1422
+
1423
+ end
1424
+
1278
1425
  class PauseAction < Action
1279
1426
 
1280
1427
  def initialize(h={})
@@ -1636,7 +1783,13 @@ end
1636
1783
  #
1637
1784
  class ToastAction < NotificationsAction
1638
1785
 
1639
- def initialize(h={})
1786
+ def initialize(obj)
1787
+
1788
+ h = if obj.is_a? Hash then
1789
+ obj
1790
+ else
1791
+ {msg: obj}
1792
+ end
1640
1793
 
1641
1794
  if h[:msg] then
1642
1795
  h[:message_text] = h[:msg]
@@ -1667,7 +1820,7 @@ class ToastAction < NotificationsAction
1667
1820
  end
1668
1821
 
1669
1822
  def to_s(colour: false)
1670
- "Popup Message\n %s" % @h[:message_text]
1823
+ @s = "Popup Message\n %s" % @h[:message_text]
1671
1824
  end
1672
1825
 
1673
1826
  end
@@ -1278,6 +1278,28 @@ class SunriseSunsetTrigger < Trigger
1278
1278
  end
1279
1279
 
1280
1280
 
1281
+ # Category: MacroDroid Specific
1282
+ #
1283
+ class EmptyTrigger < Trigger
1284
+
1285
+ def initialize(h={})
1286
+
1287
+ options = {
1288
+
1289
+ }
1290
+
1291
+ super(options.merge h)
1292
+
1293
+ end
1294
+
1295
+ def to_s(colour: false)
1296
+ 'EmptyTrigger'
1297
+ end
1298
+
1299
+ alias to_summary to_s
1300
+ end
1301
+
1302
+
1281
1303
  class SensorsTrigger < Trigger
1282
1304
 
1283
1305
  def initialize(h={})
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.3
4
+ version: 0.8.4
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-16 00:00:00.000000000 Z
38
+ date: 2020-09-18 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: glw
metadata.gz.sig CHANGED
Binary file