secret_knock 0.2.1 → 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
  SHA1:
3
- metadata.gz: 65090eccf99cdc0971ace6bdf7a458639b972266
4
- data.tar.gz: 9a19b89e369d5b01f6a5afb03928f6d5b1d9bdf4
3
+ metadata.gz: 45218ba7c579c8674c984e1a83fa2afe215402ed
4
+ data.tar.gz: 793385f2bcd5587cdf11047e5427dfe8436bb206
5
5
  SHA512:
6
- metadata.gz: a6e44c15c13622c66a1bdd55c6f476b3583b9c1e091d5c7cdcd02304042157c35a488eb71f468458f892aeef0423e97b92e77573ef75743d6091c77b773ef318
7
- data.tar.gz: 7b38d20b6ab6320480114b7f5769699dd47ae3f5fb4241d1d220a90176a64773060affd254328cd4d9630d8529c036a146630618a5f8849d40c7065e313ff415
6
+ metadata.gz: 51dd80db361b32eb2b0b5dae29a5a08ce27d90473566cb36a21b5dabc3f6a837c2fb0fe6992d63f98141edf7bc457101478eb794e88effa7d7c366731e4f1859
7
+ data.tar.gz: 243272b1f2e1d4b30525e6da08e23f962bed1f5a0d068fb9640233368a20bc49867b7dfd6da35ac525837ff7594f279775f7926a458f46e049e8347072557ed4
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- ��+Ʌ������;?o�@?i�����k��L.#�m�*������ه�t7���7���|u;_2eh�jb��88cpsML��pU����0eY^��lް��#;C�,�ҿ�9�iKcO�VZ޼�=|ъ��uZv���J.U+m��VO�ǻ�_��b{��z8C��Z�
2
- $y�&��8ܓl��n�~[� V{�;��:/� ��P����D���x�H���S�6U������ߘp&
1
+ SYT[4|� j��ØGm��&�k�VJ��l���,��7S|g2(E7y�#]d#UtZ��B��u
2
+ �N �%��~��Պ��Bu
data/lib/secret_knock.rb CHANGED
@@ -55,15 +55,31 @@ class SecretKnock
55
55
  end
56
56
 
57
57
  def detect(timeout: 2, repeat: true)
58
-
58
+
59
59
  listen
60
60
 
61
61
  Thread.new do
62
-
62
+
63
+ if @external and @external.respond_to? :on_listening then
64
+ @external.on_listening
65
+ end
66
+
63
67
  sleep 0.2 while @t + timeout > Time.now or @a.length <= 1
68
+
69
+ if @external and @external.respond_to? :on_processing then
70
+ @external.on_processing
71
+ end
72
+
64
73
  msg = decipher()
65
74
  on_timeout msg
66
- @external.message msg if @external
75
+
76
+ begin
77
+ @external.message msg if @external
78
+ rescue
79
+ puts
80
+ puts "\rSecretKnock @external notifier " + ($!).inspect
81
+ end
82
+
67
83
  detect(timeout: timeout, repeat: repeat) if repeat
68
84
  end
69
85
  end
@@ -99,8 +115,6 @@ class SecretKnock
99
115
  def knocks(n)
100
116
 
101
117
  n.times { knocked }
102
-
103
- puts (['knock'] * n).join ', ' if @verbose
104
118
  short_pause
105
119
 
106
120
  end
@@ -171,10 +185,10 @@ class SecretKnock
171
185
 
172
186
  def decipher()
173
187
 
174
- @a.join.gsub(/(\d{2})(\d)/,'\1,\2').split(',')\
175
- .inject([]) do |r, x|
188
+ @a.join.gsub(/(\d{2})(\d)/,'\1,\2').split(',').inject([]) do |r, x|
176
189
  (x != '42' ? r << @hb[x.to_i] : r[0..-2])
177
- end.join
190
+ end.join
191
+
178
192
  end
179
193
 
180
194
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secret_knock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  99xt/V2xyDfAqj78KwcwRRl/reRM/gEwgnYu81SLIJj/VBHE111bleyFUb95Y6rQ
32
32
  Zs+o5zexvKrktw==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-01-20 00:00:00.000000000 Z
34
+ date: 2016-04-19 00:00:00.000000000 Z
35
35
  dependencies: []
36
36
  description:
37
37
  email: james@r0bertson.co.uk
metadata.gz.sig CHANGED
Binary file