1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-11-14 22:07:17 +00:00
test-tutorial-framework/hack/bootstrap_tfw_dev.sh

42 lines
1.4 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2018-03-23 20:39:39 +00:00
set -eo pipefail
2018-03-24 10:47:38 +00:00
TFW_POSTFIX=tutorial-framework
BASEIMAGE=baseimage-${TFW_POSTFIX}
2018-03-30 21:56:14 +00:00
TEST=test-${TFW_POSTFIX}
2018-03-24 10:47:38 +00:00
FRONTEND=frontend-${TFW_POSTFIX}
LOGFILE=/tmp/bootstrap_tfw.log
[ "$(uname)" == "Darwin" ] && sed_cmd="gsed" || sed_cmd="sed"
showlog() { echo && echo "Error! Showing logs:" && cat $LOGFILE; }
cleanlog() { rm $LOGFILE; }
trap showlog ERR
trap cleanlog EXIT
: > $LOGFILE
echo -n "Cloning TFW repositories... "
[ ! -z "$TFWDEV" ] && echo -n "baseimage... " && git clone git@github.com:avatao-content/${BASEIMAGE}.git >> $LOGFILE 2>&1 || :
2018-03-24 10:47:38 +00:00
echo -n "frontend... " && git clone git@github.com:avatao-content/${FRONTEND}.git >> $LOGFILE 2>&1
2018-03-30 21:56:14 +00:00
echo -n "test... " && git clone git@github.com:avatao-content/${TEST}.git >> $LOGFILE 2>&1
echo "Done!"
echo
if [ -z "$TFWDEV" ]; then
TFWURL=https://registry.hub.docker.com/v1/repositories/avatao/tutorial-framework/tags
PYTHON_PARSEJSON="import sys, json; print json.load(sys.stdin)[-1]['name']"
LATESTTAG="$(curl -fsSL ${TFWURL} | python -c "${PYTHON_PARSEJSON}")"
$sed_cmd -i "1 s/.*/&:${LATESTTAG}/" "${TEST}/solvable/Dockerfile"
rm -rf "${TEST}/.git"
rm -rf "${FRONTEND}/.git"
fi
echo -n "Installing frontend dependencies... "
cd ${FRONTEND}
yarn install >> $LOGFILE 2>&1
wait
echo "Done!"
echo
2018-03-30 21:56:14 +00:00
echo "You can build & start TFW by executing the command: ${TEST}/hack/tfw.sh buildstart"