winr 1.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/winr +37 -24
- data/winr.gemspec +1 -1
- 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: 92cf6d6550696708f56fbdaf257a4dc03c45f492d29da6e48c6402475e5b6071
|
4
|
+
data.tar.gz: a5453c06028778540c0c46d1822917a634dd295f2689cc96eed153ed436c7e7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2b10ae402f1d2852fb383d8ac37edaa62bd745934f69b7365cf4ffd11030fe1e7ec33e663a8b375ea35dc81ee7f89d5c31332735117ee24e23c307ee6f6ef9c
|
7
|
+
data.tar.gz: ef2bddad89692a60e7f0eb3f06d7644c029918bd2bfbe10916ae4fe307b58fd32470ee6c203cfa3bc655c09d506878149da969739bdc655e78cbcfdf831cba58
|
data/bin/winr
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# 1. Enable YAML config files
|
16
16
|
# ============================================================================
|
17
17
|
|
18
|
-
trap("INT"
|
18
|
+
trap("INT") { abort "\n" }
|
19
19
|
|
20
20
|
require "erb"
|
21
21
|
require "optparse"
|
@@ -150,6 +150,29 @@ def compile(task, path)
|
|
150
150
|
|
|
151
151
|
end
|
152
152
|
|
153
|
+
def template
|
154
|
+
<<~"end"
|
155
|
+
# ============================================================================
|
156
|
+
# Environment <%= ei + 1 %>: <%= e.name %>
|
157
|
+
# Context <%= ci + 1 %>: <%= c.name %>
|
158
|
+
# Task <%= ti + 1 %>: <%= t.name %>
|
159
|
+
# ============================================================================
|
160
|
+
|
161
|
+
trap("INT") { exit }
|
162
|
+
|
163
|
+
# def __winr_timer; Process.clock_gettime(Process::CLOCK_MONOTONIC); end
|
164
|
+
def __winr_timer; Time.now.to_f; end
|
165
|
+
|
166
|
+
<%= e.begin %>
|
167
|
+
<%= c.begin %>
|
168
|
+
|
169
|
+
<%= compile(t, file.path) %>
|
170
|
+
|
171
|
+
<%= c.end %>
|
172
|
+
<%= e.end %>
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
153
176
|
# ==[ Helpers ]==
|
154
177
|
|
155
178
|
def boxlines(main, cols, runs=1)
|
@@ -204,7 +227,7 @@ end
|
|
204
227
|
|
205
228
|
# read the winr script
|
206
229
|
winr = ARGV.first or abort "missing winr script"
|
207
|
-
tmpl = ERB.new(
|
230
|
+
tmpl = ERB.new(template)
|
208
231
|
|
209
232
|
# grok the config
|
210
233
|
$config = eval(File.read(winr))
|
@@ -212,6 +235,16 @@ es = $config.environments || [{}]
|
|
212
235
|
cs = $config.contexts || [{}]
|
213
236
|
ts = $config.tasks || [{}]
|
214
237
|
|
238
|
+
# adjust script fields, if needed
|
239
|
+
[es, cs].each do |item|
|
240
|
+
if item.script
|
241
|
+
if item.begin || item.end
|
242
|
+
abort "scripts for environments and contexts should go into begin or end"
|
243
|
+
end
|
244
|
+
item.begin = item.script
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
215
248
|
# box drawing
|
216
249
|
cols = stats(show)
|
217
250
|
full = cols.map(&:size).sum + cols.size * 11 - 3
|
@@ -229,6 +262,7 @@ es.each_with_index do |e, ei|
|
|
229
262
|
puts IO.popen(["ruby", "-v"].join(" "), &:read) unless hush
|
230
263
|
puts rt
|
231
264
|
|
265
|
+
# TODO: read this from e.command
|
232
266
|
command = ["/usr/bin/env ruby"]
|
233
267
|
|
234
268
|
# loop over context(s) and task(s)
|
@@ -274,8 +308,8 @@ full = cols.sum + (cols.size - 1) * 3
|
|
274
308
|
rt, rm, rb = boxlines(wide, cols)
|
275
309
|
rh = "│ %-*.*s │" % [wide, wide, "Rank"]
|
276
310
|
rh << " %-*.*s │" % [full, full, "Performance".center(full)]
|
277
|
-
|
278
311
|
puts rt, rh, rm
|
312
|
+
|
279
313
|
flip = cs.size > 1 && ts.size == 1
|
280
314
|
rank.each do |ips, ei, ci, ti|
|
281
315
|
name = (flip ? cs[ci] : ts[ti]).name
|
@@ -291,24 +325,3 @@ rank.each do |ips, ei, ci, ti|
|
|
291
325
|
end
|
292
326
|
puts rb
|
293
327
|
puts "```" unless hush
|
294
|
-
|
295
|
-
__END__
|
296
|
-
|
297
|
-
# ============================================================================
|
298
|
-
# Environment <%= ei + 1 %>: <%= e.name %>
|
299
|
-
# Context <%= ci + 1 %>: <%= c.name %>
|
300
|
-
# Task <%= ti + 1 %>: <%= t.name %>
|
301
|
-
# ============================================================================
|
302
|
-
|
303
|
-
trap("INT") { exit }
|
304
|
-
|
305
|
-
# def __winr_timer; Process.clock_gettime(Process::CLOCK_MONOTONIC); end
|
306
|
-
def __winr_timer; Time.now.to_f; end
|
307
|
-
|
308
|
-
<%= e.begin %>
|
309
|
-
<%= c.begin %>
|
310
|
-
|
311
|
-
<%= compile(t, file.path) %>
|
312
|
-
|
313
|
-
<%= c.end %>
|
314
|
-
<%= e.end %>
|
data/winr.gemspec
CHANGED