2013-03-18 09:48:50 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-03-21 03:50:13 -07:00
|
|
|
set -e
|
|
|
|
|
2013-03-18 09:48:50 -07:00
|
|
|
cat <<EOF
|
|
|
|
package blob
|
|
|
|
var files = map [string] map [string] []byte {
|
|
|
|
EOF
|
|
|
|
|
2013-03-21 03:50:13 -07:00
|
|
|
ORIGINAL_PWD=${PWD}
|
|
|
|
|
2013-03-18 09:48:50 -07:00
|
|
|
for dir in $@
|
|
|
|
do
|
2013-03-21 03:50:13 -07:00
|
|
|
cd "${dir}"
|
|
|
|
echo "\"$(basename ${dir})\": {"
|
2013-03-18 09:48:50 -07:00
|
|
|
|
2015-01-26 06:10:27 -08:00
|
|
|
# Do not embed map files and the non-minified bootstrap files.
|
2015-02-02 03:37:39 -08:00
|
|
|
# TODO(beorn7): There should be a better solution than hardcoding the
|
|
|
|
# exclusion here. We might want to switch to a less makeshift way of
|
|
|
|
# embedding files into the binary anyway...
|
2015-01-26 06:10:27 -08:00
|
|
|
find . -type f \! -name \*.map \! -name bootstrap.js \! -name bootstrap-theme.css \! -name bootstrap.css | while read file
|
2013-03-18 09:48:50 -07:00
|
|
|
do
|
2013-03-21 03:50:13 -07:00
|
|
|
name=$(echo "${file}"|sed 's|\.\/||')
|
2013-03-20 04:31:42 -07:00
|
|
|
echo "\"$name\": {"
|
2013-03-21 03:50:13 -07:00
|
|
|
gzip -9 -c "${file}" | xxd -p |sed 's/\(..\)/0x\1, /g'
|
2013-03-20 04:31:42 -07:00
|
|
|
echo "},"
|
2013-03-18 09:48:50 -07:00
|
|
|
echo
|
|
|
|
done
|
2013-03-20 04:31:42 -07:00
|
|
|
echo "},"
|
2013-03-21 03:50:13 -07:00
|
|
|
cd "${ORIGINAL_PWD}"
|
2013-03-18 09:48:50 -07:00
|
|
|
done
|
|
|
|
echo '}'
|