github.com/KyaXTeam/consul@v1.4.5/ui/scripts/dist.sh (about) 1 #!/usr/bin/env bash 2 set -e 3 4 # Get the parent directory of where this script is. 5 SOURCE="${BASH_SOURCE[0]}" 6 while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done 7 DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" 8 9 # Change into that directory 10 cd "$DIR" 11 12 # Generate the tag 13 DEPLOY="../pkg/web_ui/v1" 14 15 rm -rf $DEPLOY 16 mkdir -p $DEPLOY 17 18 bundle check >/dev/null 2>&1 || bundle install 19 bundle exec sass styles/base.scss static/base.css 20 21 bundle exec ruby scripts/compile.rb 22 23 # Copy into deploy 24 shopt -s dotglob 25 cp -r $DIR/static $DEPLOY/ 26 cp index.html $DEPLOY/ 27 28 # Magic scripting 29 sed -E -e "/ASSETS/,/\/ASSETS/ d" -ibak $DEPLOY/index.html 30 sed -E -e "s#<\/body>#<script src=\"static/application.min.js\"></script></body>#" -ibak $DEPLOY/index.html 31 32 # Remove the backup file from sed 33 rm $DEPLOY/index.htmlbak 34 35 # pushd $(dirname $DEPLOY) >/dev/null 2>&1 36 # zip -r ../web_ui.zip ./* 37 # popd >/dev/null 2>&1