wassup 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/wassup +2 -1
- data/lib/wassup/app.rb +6 -3
- data/lib/wassup/pane.rb +34 -5
- data/lib/wassup/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2164cf9c9102e1abf2ba7703a50018ae66e2b16ca3ff7202f2b9bb34e250e6b3
|
4
|
+
data.tar.gz: c5178959ef98124fddc2b6af5901b3fe718a4f1c8cc49fa177ec438aff3453e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28ce6b6d4b756b0e5f90e99947929293a2edbd1a63dbc51deef9c4ab411ed6638eea892c0e86e896a4d746502ef9b880f7ed6d01d004410832def9aaad45762e
|
7
|
+
data.tar.gz: 3e8053061acc17ad9aa8fee89ca161d5547a05f2ae3d0a79d4871a8f4be384ad2072564fad67ca4bb7d229a6f1c104e0ec2a90718d1b5b95d81a82f972699fde
|
data/Gemfile.lock
CHANGED
data/bin/wassup
CHANGED
@@ -4,6 +4,7 @@ require 'wassup'
|
|
4
4
|
|
5
5
|
debug = ARGV.delete("--debug")
|
6
6
|
path = ARGV[0] || 'Supfile'
|
7
|
+
port = ARGV[1] || 0
|
7
8
|
|
8
9
|
unless File.exists?(path)
|
9
10
|
raise "Missing file: #{path}"
|
@@ -12,5 +13,5 @@ end
|
|
12
13
|
if debug
|
13
14
|
Wassup::App.debug(path: path)
|
14
15
|
else
|
15
|
-
Wassup::App.start(path: path)
|
16
|
+
Wassup::App.start(path: path, port: port.to_i)
|
16
17
|
end
|
data/lib/wassup/app.rb
CHANGED
@@ -2,7 +2,7 @@ require 'curses'
|
|
2
2
|
|
3
3
|
module Wassup
|
4
4
|
class App
|
5
|
-
def self.start(path:)
|
5
|
+
def self.start(path:, port:)
|
6
6
|
Curses.init_screen
|
7
7
|
Curses.start_color
|
8
8
|
Curses.curs_set(0) # Invisible cursor
|
@@ -17,7 +17,7 @@ module Wassup
|
|
17
17
|
#Curses.init_pair(Curses::COLOR_BLUE,Curses::COLOR_BLUE,Curses::COLOR_BLACK)
|
18
18
|
#Curses.init_pair(Curses::COLOR_RED,Curses::COLOR_RED,Curses::COLOR_BLACK)
|
19
19
|
|
20
|
-
app = App.new(path: path)
|
20
|
+
app = App.new(path: path, port: port)
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.debug(path:)
|
@@ -78,6 +78,7 @@ module Wassup
|
|
78
78
|
content_block: pane_builder.content_block,
|
79
79
|
selection_blocks: pane_builder.selection_blocks,
|
80
80
|
selection_blocks_description: pane_builder.selection_blocks_description,
|
81
|
+
port: self.port,
|
81
82
|
debug: debug
|
82
83
|
)
|
83
84
|
pane.focus_handler = @focus_handler
|
@@ -85,9 +86,11 @@ module Wassup
|
|
85
86
|
end
|
86
87
|
|
87
88
|
attr_accessor :panes
|
89
|
+
attr_accessor :port
|
88
90
|
attr_accessor :debug
|
89
91
|
|
90
|
-
def initialize(path:, debug: false)
|
92
|
+
def initialize(path:, port: nil, debug: false)
|
93
|
+
@port = port
|
91
94
|
@hidden_pane = nil
|
92
95
|
@help_pane = nil
|
93
96
|
@focused_pane = nil
|
data/lib/wassup/pane.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'curses'
|
2
2
|
|
3
|
+
require 'socket'
|
3
4
|
require 'time'
|
4
5
|
|
5
6
|
module Wassup
|
@@ -42,6 +43,8 @@ module Wassup
|
|
42
43
|
|
43
44
|
attr_accessor :win_height, :win_width, :win_top, :win_left
|
44
45
|
|
46
|
+
attr_accessor :port
|
47
|
+
|
45
48
|
class Content
|
46
49
|
class Row
|
47
50
|
attr_accessor :display
|
@@ -68,7 +71,9 @@ module Wassup
|
|
68
71
|
end
|
69
72
|
end
|
70
73
|
|
71
|
-
def initialize(height, width, top, left, title: nil, description: nil, alert_level: nil, highlight: true, focus_number: nil, interval:, show_refresh:, content_block:, selection_blocks:, selection_blocks_description:, debug: false)
|
74
|
+
def initialize(height, width, top, left, title: nil, description: nil, alert_level: nil, highlight: true, focus_number: nil, interval:, show_refresh:, content_block:, selection_blocks:, selection_blocks_description:, port: nil, debug: false)
|
75
|
+
|
76
|
+
self.port = port
|
72
77
|
|
73
78
|
if !debug
|
74
79
|
self.win_height = Curses.lines * height
|
@@ -236,6 +241,8 @@ module Wassup
|
|
236
241
|
|
237
242
|
self.update_box
|
238
243
|
self.update_title
|
244
|
+
|
245
|
+
self.send_to_socket
|
239
246
|
else
|
240
247
|
# This shouldn't happen
|
241
248
|
# TODO: also fix this
|
@@ -325,6 +332,31 @@ module Wassup
|
|
325
332
|
self.last_refresh_char_at = Time.now
|
326
333
|
end
|
327
334
|
end
|
335
|
+
|
336
|
+
def send_to_socket
|
337
|
+
return if self.port.nil?
|
338
|
+
return if self.port.to_i == 0
|
339
|
+
|
340
|
+
data = {
|
341
|
+
title: self.title,
|
342
|
+
description: self.description,
|
343
|
+
alert_level: self.alert_level,
|
344
|
+
alert_count: self.alert_count
|
345
|
+
}
|
346
|
+
|
347
|
+
sock = TCPSocket.new('127.0.0.1', self.port)
|
348
|
+
sock.write(data.to_json)
|
349
|
+
sock.close
|
350
|
+
end
|
351
|
+
|
352
|
+
def alert_count
|
353
|
+
alert_count = 0
|
354
|
+
if self.contents
|
355
|
+
alert_count = self.contents.map { |c| c.data.size }.inject(0, :+)
|
356
|
+
end
|
357
|
+
|
358
|
+
return alert_count
|
359
|
+
end
|
328
360
|
|
329
361
|
def update_title
|
330
362
|
return unless self.should_box
|
@@ -343,10 +375,7 @@ module Wassup
|
|
343
375
|
|
344
376
|
self.win.setpos(0, 3 + full_title.size)
|
345
377
|
alert = ""
|
346
|
-
alert_count =
|
347
|
-
if self.contents
|
348
|
-
alert_count = self.contents.map { |c| c.data.size }.inject(0, :+)
|
349
|
-
end
|
378
|
+
alert_count = self.alert_count
|
350
379
|
case self.alert_level
|
351
380
|
when AlertLevel::HIGH
|
352
381
|
self.win.attrset(Curses.color_pair(Wassup::Color::Pair::RED))
|
data/lib/wassup/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wassup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Holtz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|