box-o-sand/conway/gen-web-assets

30 lines
663 B
Bash
Executable File

#!/bin/sh
set -e
case "$1" in
"shell")
cat > _tmp.go <<EOWEBASSETSGO
// WARNING: GENERATED FILE, NERDS! $(date)
package conway
const (
gameOfLifeIndexHtml = \`
$(cat web_assets/index.html | gzip -9 | base64)\`
normalizeCss = \`
$(curl -s http://necolas.github.com/normalize.css/2.0.1/normalize.css | gzip -9 | base64)\`
jqueryMinJs = \`
$(curl -s http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js | gzip -9 | base64)\`
)
EOWEBASSETSGO
cat _tmp.go | gofmt > web_assets.go
rm -v _tmp.go
;;
*)
cd web_assets
go build -x .
./web_assets index.html > _tmp.go
gofmt < _tmp.go > ../web_assets.go
rm -vf _tmp.go
;;
esac