38 lines
1.3 KiB
Bash
Executable File
38 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright 2015 Google Inc. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
GIT_ROOT=$(dirname "${BASH_SOURCE}")/..
|
|
YEAR=$(date +%Y)
|
|
|
|
TMP_OUTPUT="/tmp/cadvisor_assets.go"
|
|
ASSETS_OUTPUT=$GIT_ROOT/pages/static/assets.go
|
|
|
|
go get -u github.com/jteeuwen/go-bindata/...
|
|
|
|
for f in $GIT_ROOT/pages/assets/**/*; do
|
|
if [ "$f" -nt $ASSETS_OUTPUT -o ! -e $ASSETS_OUTPUT ]; then
|
|
go-bindata -o $ASSETS_OUTPUT -pkg static $GIT_ROOT/pages/assets/...
|
|
cat build/boilerplate/boilerplate.go.txt | sed "s/YEAR/$YEAR/" > "${TMP_OUTPUT}"
|
|
echo -e "// generated by build/assets.sh; DO NOT EDIT\n" >> "${TMP_OUTPUT}"
|
|
cat "${ASSETS_OUTPUT}" >> "${TMP_OUTPUT}"
|
|
gofmt -w -s "${TMP_OUTPUT}"
|
|
mv "${TMP_OUTPUT}" "${ASSETS_OUTPUT}"
|
|
break
|
|
fi
|
|
done
|
|
|
|
exit 0
|