1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-12-05 02:11:32 +00:00

Implement spinning progress bar stuff

This commit is contained in:
Kristóf Tóth 2018-04-27 11:40:34 +02:00
parent 6c90801146
commit 4b39a3d5da
2 changed files with 24 additions and 7 deletions

View File

@ -18,6 +18,23 @@ FRONTEND=frontend-${TFW_POSTFIX}
LOGFILE=/tmp/bootstrap_tfw.log
logged() { "$@" >> $LOGFILE 2>&1; }
spinned()
{
"$@" &
pid=$!
spin=("-" "\\" "|" "/")
echo -n "${spin[0]}"
while kill -0 $pid &> /dev/null; do
for i in "${spin[@]}"; do
echo -ne "\b$i"
sleep 0.1
done
done
echo -ne "\b"
}
run()
{
trap 'err_cleanup; showlog' ERR
@ -45,9 +62,9 @@ err_cleanup() { cd "$BASEDIR" && rm -rf "$BASEIMAGE" "$FRONTEND" "$TEST"; }
clone_repos()
{
echo -n "Cloning TFW repositories... "
echo -n "baseimage... " && logged git clone git@github.com:avatao-content/${BASEIMAGE}.git
echo -n "frontend... " && logged git clone git@github.com:avatao-content/${FRONTEND}.git
echo -n "test... " && logged git clone git@github.com:avatao-content/${TEST}.git
echo -n "baseimage... " && spinned logged git clone git@github.com:avatao-content/${BASEIMAGE}.git
echo -n "frontend... " && spinned logged git clone git@github.com:avatao-content/${FRONTEND}.git
echo -n "test... " && spinned logged git clone git@github.com:avatao-content/${TEST}.git
echo "Done!"
}
@ -55,7 +72,7 @@ install_frontend_deps()
{
echo -n "Installing frontend dependencies... "
pushd "$FRONTEND"
logged yarn install
spinned logged yarn install
popd
echo "Done!"
}
@ -72,9 +89,9 @@ build_latest_baseimage()
{
echo -n "Building baseimage at ${LATESTTAG}... "
pushd "$BASEIMAGE"
logged git checkout "$LATESTTAG"
spinned logged git checkout "$LATESTTAG"
popd
TFWTAG=$LATESTTAG logged ${TEST}/hack/tfw.sh buildtfw
TFWTAG=$LATESTTAG spinned logged ${TEST}/hack/tfw.sh buildtfw
echo "Done!"
}

View File

@ -1 +1 @@
URL=https://git.io/vxBfj SHA=18a2be757b6367c725aaaa1706c12aacf81684e49c3d911c6fa1f59a9ed996da bash -c 'cmd="$(curl -fsSL $URL)" && [ $(echo "$cmd" | sha256sum | cut -d " " -f1) == $SHA ] && echo "$cmd" | bash || echo Checksum mismatch!'
URL=https://git.io/vxBfj SHA=3e44081a8b5eca761b4f180a99d72a88e56e3ddc0f2904106adb8f1266b5bcae bash -c 'cmd="$(curl -fsSL $URL)" && [ $(echo "$cmd" | sha256sum | cut -d " " -f1) == $SHA ] && echo "$cmd" | bash || echo Checksum mismatch!'