presbeus 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/presbeus.rb +14 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eea09fd03cf7af2de9921d9c8f3e53340844c7116bf4f7230a5c5019fce0f019
|
4
|
+
data.tar.gz: 27cc21be3c8ff6115e0407b8fb5155dd3be911d167b27edb2f3d05b27c1896b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba173e6118cfa5565e77e86509e38eab2989d1b1a46b976225932345c3952bf021ef55e91ec92c47e00d3f1412a3c0d855f49a38ceab219ba0bd733a91fa126
|
7
|
+
data.tar.gz: e5308228230436aa04bb5693c39ec96d191b557f36cc1d734c9c21bb85231d3f8db4028b85f5b179c0597755dd26a532877819d65f46f33f07057ee04890b870
|
data/lib/presbeus.rb
CHANGED
@@ -23,6 +23,7 @@ class Presbeus
|
|
23
23
|
def initialize_arguments
|
24
24
|
argument(:help, [], "show this help") { help }
|
25
25
|
argument(:realtime, [], "handle realtime event stream") { realtime }
|
26
|
+
argument(:realtime_raw, [], "handle realtime event stream") { @client = false; realtime }
|
26
27
|
argument(:shell, [], "run in an interactive shell") { shell }
|
27
28
|
argument(:devices, [], "list devices") { puts table devices }
|
28
29
|
argument(:pushes, [], "list pushes") { puts table pushes_with_color }
|
@@ -67,10 +68,14 @@ class Presbeus
|
|
67
68
|
json = JSON.parse(message)
|
68
69
|
type = json["type"]
|
69
70
|
if type != "nop"
|
70
|
-
if
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
if @client
|
72
|
+
if type == "tickle"
|
73
|
+
puts(table(pushes_with_color(Time.now.to_i) do |push|
|
74
|
+
`#{@notify_command} "#{push[1]}"` if @notify_command
|
75
|
+
end))
|
76
|
+
end
|
77
|
+
else
|
78
|
+
puts message
|
74
79
|
end
|
75
80
|
else
|
76
81
|
client.send message # pong
|
@@ -80,11 +85,15 @@ class Presbeus
|
|
80
85
|
end
|
81
86
|
|
82
87
|
def realtime
|
88
|
+
$stdout.sync = true if !@cient
|
83
89
|
while true
|
84
90
|
begin
|
85
91
|
realtime_no_reconnect
|
86
92
|
rescue Kontena::Websocket::TimeoutError => e
|
87
|
-
puts "timeout #{e}"
|
93
|
+
puts "timeout #{e}" if @client
|
94
|
+
rescue Kontena::Websocket::ConnectError => e
|
95
|
+
puts "connect error #{e}" if @client
|
96
|
+
sleep 60
|
88
97
|
end
|
89
98
|
end
|
90
99
|
end
|