presbeus 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/presbeus.rb +14 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e7633c37a27646e9152e26c23931083387d27ccfb8c44cd46d4400afb4e8df3
4
- data.tar.gz: 77edadaa30fd8fdd5dc13acd5c8da38ae76980f424439bf188984ccc2b234b27
3
+ metadata.gz: eea09fd03cf7af2de9921d9c8f3e53340844c7116bf4f7230a5c5019fce0f019
4
+ data.tar.gz: 27cc21be3c8ff6115e0407b8fb5155dd3be911d167b27edb2f3d05b27c1896b8
5
5
  SHA512:
6
- metadata.gz: 5226e7fba4cc0b882108612777ad1b45044a618a9c7d1b9102ece578928ca3e4c82fd131d74025e4a30c7e580168fb996147d1268bdc90cce30a944efd9affd0
7
- data.tar.gz: '0693b4c79e124bfacf0c8c4ef55399d78be631ff88ce34195b2ebd59434bad80c2fdf6bdcf2fcd2625d0d90ba54a0c5deefce4f89aec0b5841897451aafae61e'
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 type == "tickle"
71
- puts(table(pushes_with_color(Time.now.to_i) do |push|
72
- `#{@notify_command} "#{push[1]}"` if @notify_command
73
- end))
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: presbeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Abdesselam