mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-14 21:47:18 +00:00
Implement bootstrap script dependency checking
This commit is contained in:
parent
1678f81315
commit
6679a3b1ef
@ -14,26 +14,7 @@ BASEDIR="$(pwd)"
|
||||
BASEIMAGE=baseimage-${TFW_POSTFIX}
|
||||
TEST=test-${TFW_POSTFIX}
|
||||
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()
|
||||
{
|
||||
@ -41,6 +22,7 @@ run()
|
||||
trap cleanlog EXIT
|
||||
: > $LOGFILE
|
||||
|
||||
check_dependencies
|
||||
clone_repos
|
||||
install_frontend_deps
|
||||
if [ "$TFWDEV" == "0" ]; then
|
||||
@ -55,6 +37,22 @@ run()
|
||||
echo "You can build & start TFW by executing the command: ${TEST}/hack/tfw.sh start"
|
||||
}
|
||||
|
||||
check_dependencies()
|
||||
{
|
||||
dependencies=("git" "docker" "yarn" "ng")
|
||||
missing="0"
|
||||
for dep in ${dependencies[@]}; do
|
||||
if ! type "$dep" > /dev/null 2>&1; then
|
||||
echo "Dependency '${dep}' not found!"
|
||||
missing="1"
|
||||
fi
|
||||
done
|
||||
if [ "$missing" == "1" ]; then
|
||||
echo "Please install the missing packages and retry!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
showlog() { echo && echo "Error! Showing logs:" && cat $LOGFILE; }
|
||||
cleanlog() { rm $LOGFILE; }
|
||||
err_cleanup() { cd "$BASEDIR" && rm -rf "$BASEIMAGE" "$FRONTEND" "$TEST"; }
|
||||
@ -120,4 +118,25 @@ merge_repos()
|
||||
echo "Done!"
|
||||
}
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user