vete 0.6.0 → 0.6.2
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 +9 -8
- 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: ed49e57cfc742410d72465e306317b8710b4442ac76e96f076a946c0772fa3a6
|
4
|
+
data.tar.gz: 6401087237fe0105ccf98035553a034fa28a87e72d2d7dca22fc097c61f37ff7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eae490b4b8b0dc6237cb12f32a8f66354b6c034723481db5238f4b93fa2ef012e8c2168f2b0184567d267434d118a405a0a7f0c769c602ee3a58a6574948883
|
7
|
+
data.tar.gz: 9e28550582a169c9d00acbfca55eecf802ee0ea989a2e1ae1077e735aad173561a1566ba8ab7242684861c3bdddb6c5c1a2d8c483d90d472e66c27fcb642e920
|
data/lib/vete.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# vete - Ruby CLI to spawn processes to get work done
|
3
3
|
#
|
4
4
|
# Author: Steve Shreeve (steve.shreeve@gmail.com)
|
5
|
-
# Date: Mar
|
5
|
+
# Date: Mar 22, 2023
|
6
6
|
# ============================================================================
|
7
7
|
|
8
8
|
STDOUT.sync = true
|
@@ -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.2"
|
23
23
|
@banner = "usage: #{program_name} [options]"
|
24
24
|
|
25
25
|
on "-b", "--bar <width>" , "Progress bar width, in characters", Integer
|
@@ -82,8 +82,9 @@ def vete_retry
|
|
82
82
|
move(list, @todo)
|
83
83
|
end
|
84
84
|
|
85
|
-
def vete_todo(path)
|
86
|
-
|
85
|
+
def vete_todo(path, data=nil)
|
86
|
+
path = File.join(@todo, path.to_s)
|
87
|
+
data ? File.write(path, data) : FileUtils.touch(path)
|
87
88
|
end
|
88
89
|
|
89
90
|
# ==[ Drawing ]===============================================================
|
@@ -132,10 +133,10 @@ def draw(live=0, done=0, died=0, jobs=0, info=nil)
|
|
132
133
|
print [
|
133
134
|
go(@work + 3, @len + 5),
|
134
135
|
fg("fff"),
|
135
|
-
bg("58a65c") + @char * ( gcol )
|
136
|
-
bg("f1bf42") + @char * ( ycol)
|
136
|
+
bg("58a65c") + @char * ( gcol ), # green (done)
|
137
|
+
bg("f1bf42") + @char * ( ycol), # yellow (live)
|
137
138
|
bg("d85140") + " " * (@wide - gcol - ycol).ceil, # red (rest)
|
138
|
-
go(@work + 3, @len + 5 + @wide + 3)
|
139
|
+
go(@work + 3, @len + 5 + @wide + 3),
|
139
140
|
bg("5383ec") + " %.1f%% " % [ppct * 100], # blue (done + died)
|
140
141
|
done > 0 ? (bg + " " + bg("58a65c") + " #{done} done ") : nil,
|
141
142
|
died > 0 ? (bg + " " + bg("d85140") + " #{died} died ") : nil,
|
@@ -197,7 +198,7 @@ begin
|
|
197
198
|
end
|
198
199
|
end
|
199
200
|
while @que.size != @work
|
200
|
-
sleep
|
201
|
+
sleep 0.3
|
201
202
|
draw(live, done, died, jobs, info.dup)
|
202
203
|
end
|
203
204
|
end.join
|