ruby-macrodroid 0.7.4 → 0.7.5

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: e28ec7303f297d90ed5edbbec3806c577d1fe3036851620c230b4620d4a8a98f
4
- data.tar.gz: fd27b2da1d660144aae8bc85b3f392b10b385934d1a38f65817d53ff774e382c
3
+ metadata.gz: 34125d78f367eeff973953934d50436f964bb073ffef48591ce2f09012fc2a01
4
+ data.tar.gz: 5bb75988f4d979cb80f57c912d8448837848b3d4a5b34a3e524f8fdad3ff62de
5
5
  SHA512:
6
- metadata.gz: f727092bb6f96799f1cd288e5ebf822b189d70ef2b5bcdb5bab452b93b412b737229fa6fed2d982f1233aa5f21d35fb1791e834d8ea023474c1eac6a3d330fd5
7
- data.tar.gz: 706f9423e28c7fda560bf059f4686834e4404dca9576d5682f3e43c82440a79c84e5ddeb65619a5410098993da1ee9574cc681912a94285147b40aba1468f8a8
6
+ metadata.gz: 223c51744d7dde5e4a7130d3141696df1dc4a8cda0227e0f11324c3ac71e53226c95e8acd1ae27ed62ec46d8c1c8b81060e9135d923285e59e89572985dd146c
7
+ data.tar.gz: 39490d0ceeb2bfce5c413607d1ea5a1ca87e8942bdcbfd51ecf32f2baac1a1c6fec7bf8909eda8716cc6b397ef847d4c15de6eca9892f9d244f1724d4956a1fe
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -110,13 +110,10 @@
110
110
  require 'yaml'
111
111
  require 'rowx'
112
112
  require 'uuid'
113
- #require 'glw'
114
- #require 'geozone'
113
+ require 'glw'
114
+ require 'geozone'
115
115
  require 'subunit'
116
- #require 'rxfhelper'
117
- require 'requestor'
118
- eval Requestor.read('http://a0.jamesrobertson.eu/rorb/r/ruby'){|x| x.require 'rxfhelper' }
119
-
116
+ require 'rxfhelper'
120
117
  require 'chronic_cron'
121
118
 
122
119
 
@@ -138,6 +135,12 @@ class TriggersNlp
138
135
  end
139
136
 
140
137
  def triggers(params)
138
+
139
+ # e.g. at 7:30pm daily
140
+ get /^(?:at )?(\d+:\d+(?:[ap]m)?) daily/i do |time, days|
141
+ [TimerTrigger, {time: time,
142
+ days: %w(Mon Tue Wed Thu Fri Sat Sun).join(', ')}]
143
+ end
141
144
 
142
145
  get /^(?:at )?(\d+:\d+(?:[ap]m)?) (?:on )?(.*)/i do |time, days|
143
146
  [TimerTrigger, {time: time, days: days}]
@@ -146,7 +149,7 @@ class TriggersNlp
146
149
  # time.is? 'at 18:30pm on Mon or Tue'
147
150
  get /^time.is\? ['"](?:at )?(\d+:\d+(?:[ap]m)?) (?:on )?(.*)['"]/i do |time, days|
148
151
  [TimerTrigger, {time: time, days: days.gsub(' or ',', ')}]
149
- end
152
+ end
150
153
 
151
154
  get /^shake[ _]device\??$/i do
152
155
  [ShakeDeviceTrigger, {}]
@@ -1667,14 +1670,32 @@ class TimerTrigger < Trigger
1667
1670
 
1668
1671
  def to_s()
1669
1672
 
1670
- dow = @h[:days_of_week]
1671
-
1672
- a = Date::ABBR_DAYNAMES
1673
+ dow = @h[:days_of_week]
1673
1674
 
1674
- time = Time.parse("%s:%s" % [@h[:hour], @h[:minute]]).strftime("%-H:%M%P")
1675
- days = (a[1..-1] << a.first).zip(dow).select {|_,b| b}.map(&:first)
1675
+ wd = Date::ABBR_DAYNAMES
1676
+ a = (wd[1..-1] << wd.first)
1677
+
1678
+ a2 = dow.map.with_index.to_a
1679
+ start = a2.find {|x,i| x}.last
1680
+ r = a2[start..-1].take_while {|x,i| x == true}
1681
+ r2 = a2[start..-1].select {|x,i| x}
1682
+
1683
+ days = if r == r2 then
1676
1684
 
1677
- "at %s on %s" % [time, days.join(', ')]
1685
+ x1, x2 = a2[start].last, a2[r.length-1].last
1686
+
1687
+ if (x2 - x1) >= 2 then
1688
+ "%s-%s" % [a[x1],a[x2]]
1689
+ else
1690
+ a.zip(dow).select {|_,b| b}.map(&:first).join(', ')
1691
+ end
1692
+ else
1693
+ a.zip(dow).select {|_,b| b}.map(&:first).join(', ')
1694
+ end
1695
+
1696
+ time = Time.parse("%s:%s" % [@h[:hour], @h[:minute]]).strftime("%-H:%M%P")
1697
+
1698
+ "%s %s" % [time, days]
1678
1699
  end
1679
1700
 
1680
1701
  private
@@ -2694,6 +2715,25 @@ class SetBluetoothAction < ConnectivityAction
2694
2715
 
2695
2716
  end
2696
2717
 
2718
+ class SetHotspotAction < ConnectivityAction
2719
+
2720
+ def initialize(h={})
2721
+
2722
+ options = {
2723
+ device_name: "", state: 0, turn_wifi_on: true, use_legacy_mechanism: false, mechanism: 0
2724
+
2725
+ }
2726
+
2727
+ super(options.merge h)
2728
+
2729
+ end
2730
+
2731
+ def to_s()
2732
+ action = @h[:turn_wifi_on] ? 'Enable' : 'Disable'
2733
+ action + ' Hotspot'
2734
+ end
2735
+ end
2736
+
2697
2737
  # Category: Connectivity
2698
2738
  #
2699
2739
  class SendIntentAction < ConnectivityAction
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.7.4
4
+ version: 0.7.5
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-08 00:00:00.000000000 Z
38
+ date: 2020-09-09 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: glw
metadata.gz.sig CHANGED
Binary file