-
Notifications
You must be signed in to change notification settings - Fork 148
/
generate-results.sh
executable file
·32 lines (24 loc) · 887 Bytes
/
generate-results.sh
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
#!/bin/bash -e
# This script will substitute the benchmark results into the HTML page.
# Note: editing HTML with sed may look strange, but at least we avoid using node.js and npm, and that's good.
# This is needed on Mac OS. Do `brew install coreutils`.
[ -n "$HOMEBREW_PREFIX" ] && PATH="${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin:${PATH}"
if command -v gsed >/dev/null 2>&1
then
alias sed='gsed'
fi
(
sed '/^const data = \[$/q' index.html
FIRST=1
LANG="" ls -1 */results/*.json | while read file
do
[[ $file =~ ^(hardware|versions)/ ]] && continue;
[ "${FIRST}" = "0" ] && echo -n ','
jq --compact-output ". += {\"source\": \"${file}\"}" "${file}"
FIRST=0
done
echo ']; // end of data'
sed '0,/^\]; \/\/ end of data$/d' index.html
) > index.html.new
mv index.html index.html.bak
mv index.html.new index.html