dstat_graph/generate_page.sh
Ian Wienand 2af3737de5 Update generate_page.sh
Use the new library names, and make sure there's a newline before
closing the script tag, as some minimised libraries end with a comment
to the .map file and no trailing newline, meaning we comment-out the
tag.

Change-Id: Ic3575f8da42ab67bdcb59da211aeaf8bb0654b54
2021-12-07 11:12:17 +11:00

60 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
##
## generate_page.sh
##
## Made by gaspar_d
## Login <d.gasparina@gmail.com>
##
## Started on Tue 23 Feb 20:17:04 2016 gaspar_d
## Last update Wed 11 May 17:54:27 2016 gaspar_d
##
print_usage() {
cat <<EOF
OVERVIEW: generate a standalone HTML page that you can share with your colleagues
USAGE: $0 file1.csv file2.csv ...
EOF
}
main() {
gCSVs=""
while [[ "$#" -gt "0" ]]; do
file=$1
content=`cat $file`
gCSVs="${gCSVs}\`${content}\`,"
shift;
done
gCSVs="[${gCSVs%?}]"
output=$1
html=`cat index.html | grep -v stylesheet | grep -v script | grep -v '</body>'`
echo $html
for js in js/{d3.min,jquery-3.6.0.min,nv.d3.min,bootstrap.bundle.min,dashboard,graph}.js; do
echo "<script type='text/javascript'>"
cat ${js}
echo
echo "</script>"
done
echo "<script type='text/javascript'>gCSVs=${gCSVs};</script>"
for css in css/*.css; do
echo "<style>"
cat ${css}
echo
echo "</style>"
done
echo "</body>"
echo "</html>"
}
if [ $# -eq 0 ]; then
print_usage $0
exit 1
fi
main $@