-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinalize.art
76 lines (61 loc) · 2.25 KB
/
finalize.art
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
cleanupJson: function [json][
final: replace replace replace replace json "arturo '" "" "arturo '../arturo/" "" "../arturo/" "" {'"} {"}
final: replace final " tests/" " "
final: replace final "arturo " ""
final: replace final {\\} ""
final: replace final {\\(} "("
final: replace final {\\)} ")"
final: replace final ".art" ""
return final
]
cleanupMd: function [md][
final: replace replace replace replace md "arturo '" "" "arturo '../arturo/" "" "../arturo/" "" {'`} {`}
final: replace final "| Relative |" {|}
final: replace final " tests/" " "
final: replace final "arturo " ""
final: replace final "|:---|---:|---:|---:|---:|" "|:---|---:|---:|---:|"
final: replace final {\ } ""
final: replace final {\(} "("
final: replace final {\)} ")"
final: replace final {/\|[\s0-9\.]+\|\n/} "|"++`\n`
final: replace final ".art" ""
return final
]
dt: (to :string now\day) ++ "-" ++
(to :string now\month) ++ "-" ++
(to :string now\year)
write "micro.json" cleanupJson read "micro.json"
write "macro.json" cleanupJson read "macro.json"
Totals: #[]
micros: get read.json "micro.json" 'results
Totals\micro: #[
time: sum map micros 'mic -> mic\mean
tests: size micros
]
macros: get read.json "macro.json" 'results
Totals\macro: #[
time: sum map macros 'mac -> mac\mean
tests: size macros
]
write.directory ~"results/|dt|" ø
; write ~"results/|dt|/micro.art" as.pretty.code read.json "micro.json"
; write ~"results/|dt|/macro.art" as.pretty.code read.json "macro.json"
rename "micro.json" ~"results/|dt|/micro.json"
rename "macro.json" ~"results/|dt|/macro.json"
write "micro.md" cleanupMd read "micro.md"
write "macro.md" cleanupMd read "macro.md"
rename "micro.md" ~"results/|dt|/micro.md"
rename "macro.md" ~"results/|dt|/macro.md"
write.json ~"results/|dt|/info.json" #[
filesize: to :integer volume "../arturo/bin/arturo",
commit: strip execute {!sh
cd ../arturo && git rev-parse --short HEAD
}
cloc: read.json execute {!sh
cloc --json --read-lang-def=extra/arturo-cloc.def --exclude-dir=extras ../arturo/src
}
totals: Totals
]
; write ~"results/|dt|/info.art" as.pretty.code read.json ~"results/|dt|/info.json"
delete "micro.cmd"
delete "macro.cmd"