vete 0.6.3 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vete.rb +17 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e4fc5b306a83552b0d01f0d66ed585ac21327f6d0770778329ee8f5f6a2d45b
|
4
|
+
data.tar.gz: d15f798085770e94721d3c388155292c1f18dff1cb5f588aa0ad5a952d94794a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc13e483ac0301df8c5a7ceac34577fd965a6645474c3d117f4674072d67bdc34ace32d372ae7fa6acf18f901bafc6ebb3c2242d13b474a2b8284f6fb0dbe670
|
7
|
+
data.tar.gz: fa3cecc1dd5af2ec412a3796b48df87473b5d4c8bf40401297caa4c62606be394bbc74b53405713dccdec8373dd626854177121f422d41f6155612f3d0a4b621
|
data/lib/vete.rb
CHANGED
@@ -19,7 +19,7 @@ trap("INT" ) { print clear + go; abort "\n" }
|
|
19
19
|
trap("WINCH") { print clear or draw if @pid == Process.pid }
|
20
20
|
|
21
21
|
OptionParser.new.instance_eval do
|
22
|
-
@version = "0.6.
|
22
|
+
@version = "0.6.6"
|
23
23
|
@banner = "usage: #{program_name} [options]"
|
24
24
|
|
25
25
|
on "-b", "--bar <width>" , "Progress bar width, in characters", Integer
|
@@ -31,7 +31,7 @@ OptionParser.new.instance_eval do
|
|
31
31
|
on "-w", "--workers <count>" , "Set the number of workers (default is 1)", Integer
|
32
32
|
|
33
33
|
self
|
34
|
-
end.parse!(into: opts={}) rescue abort($!.message)
|
34
|
+
end.parse!(into: @opts = opts = {}) rescue abort($!.message)
|
35
35
|
|
36
36
|
# populate CLI options
|
37
37
|
@char = opts[:char ] || "•"; @char = @char[0]
|
@@ -53,12 +53,11 @@ end
|
|
53
53
|
# define job directories
|
54
54
|
@vete = File.expand_path(".vete")
|
55
55
|
@todo = File.join(@vete, "todo")
|
56
|
-
@live = File.join(@vete, "live")
|
57
56
|
@done = File.join(@vete, "done")
|
58
57
|
@died = File.join(@vete, "died")
|
59
58
|
|
60
59
|
def move(path, dest)
|
61
|
-
dest = File.join(dest, File.basename(path))
|
60
|
+
dest = File.join(dest, File.basename(path)) unless path.is_a?(Array)
|
62
61
|
FileUtils.mv(path, dest, force: true, secure: true)
|
63
62
|
end
|
64
63
|
|
@@ -73,13 +72,13 @@ end
|
|
73
72
|
|
74
73
|
def vete_init
|
75
74
|
nuke
|
76
|
-
list = [@todo, @
|
75
|
+
list = [@todo, @done, @died]
|
77
76
|
list.each {|path| FileUtils.mkdir_p(path) }
|
78
77
|
end
|
79
78
|
|
80
79
|
def vete_retry
|
81
80
|
list = Dir.glob(File.join(@died, "*")).sort.each {|path| FileUtils.touch(path) }
|
82
|
-
move(list, @todo)
|
81
|
+
list.empty? ? false : !!move(list, @todo)
|
83
82
|
end
|
84
83
|
|
85
84
|
def vete_todo(path, data=nil)
|
@@ -96,13 +95,19 @@ def cursor(on) ; print on ? "\e[?25h": "\e[?25l"; end
|
|
96
95
|
def go(r=1,c=1) ; "\e[#{r};#{c}H" ; end
|
97
96
|
def go!(...) ; print go(...) ; end
|
98
97
|
|
99
|
-
|
100
|
-
|
101
|
-
def
|
102
|
-
|
103
|
-
|
98
|
+
@hex={}
|
99
|
+
|
100
|
+
def hex(str=nil)
|
101
|
+
@hex[str] ||= begin
|
102
|
+
str =~ /\A#?(?:(\h\h)(\h\h)(\h\h)|(\h)(\h)(\h))\z/ or return
|
103
|
+
r, g, b = $1 ? [$1, $2, $3] : [$4*2, $5*2, $6*2]
|
104
|
+
[r.hex, g.hex, b.hex] * ";"
|
105
|
+
end
|
104
106
|
end
|
105
107
|
|
108
|
+
def fg(rgb=nil); rgb ? "\e[38;2;#{hex(rgb)}m" : "\e[39m"; end
|
109
|
+
def bg(rgb=nil); rgb ? "\e[48;2;#{hex(rgb)}m" : "\e[49m"; end
|
110
|
+
|
106
111
|
def draw(live=0, done=0, died=0, jobs=0, info=nil)
|
107
112
|
|
108
113
|
# outer box
|
@@ -122,7 +127,7 @@ def draw(live=0, done=0, died=0, jobs=0, info=nil)
|
|
122
127
|
info.each do |slot, this|
|
123
128
|
tpct = this.to_f / most
|
124
129
|
cols = ppct * tpct * @wide
|
125
|
-
print go(slot + 1, @len + 5) + bg("5383ec") + @char * cols
|
130
|
+
print go(slot + 1, @len + 5) + bg("5383ec") + @char * cols # fg("fff")
|
126
131
|
end
|
127
132
|
|
128
133
|
# summary bar
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Shreeve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby CLI to spawn processes to get work done
|
14
14
|
email: steve.shreeve@gmail.com
|
@@ -44,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
requirements: []
|
47
|
-
rubygems_version: 3.4.
|
47
|
+
rubygems_version: 3.4.10
|
48
48
|
signing_key:
|
49
49
|
specification_version: 4
|
50
50
|
summary: Ruby CLI to spawn processes to get work done
|