From adcdf746738f992f86e4d3504b6893fe7fb64424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 27 Apr 2018 11:27:23 +0200 Subject: [PATCH] Use pushd and popd instald of cding around --- hack/bootstrap_tfw_dev.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/hack/bootstrap_tfw_dev.sh b/hack/bootstrap_tfw_dev.sh index 57f6743..8e845da 100755 --- a/hack/bootstrap_tfw_dev.sh +++ b/hack/bootstrap_tfw_dev.sh @@ -5,12 +5,17 @@ set -o errtrace shopt -s expand_aliases [ "$(uname)" == "Darwin" ] && alias sed="gsed" || : +pushd() { command pushd "$@" > /dev/null; } +popd() { command popd "$@" > /dev/null; } + TFWDEV="${TFWDEV:-0}" TFW_POSTFIX=tutorial-framework BASEIMAGE=baseimage-${TFW_POSTFIX} TEST=test-${TFW_POSTFIX} FRONTEND=frontend-${TFW_POSTFIX} + LOGFILE=/tmp/bootstrap_tfw.log +logged() { "$@" >> $LOGFILE 2>&1; } run() { @@ -39,18 +44,18 @@ err_cleanup() { rm -rf "$BASEIMAGE" "$FRONTEND" "$TEST"; } clone_repos() { echo -n "Cloning TFW repositories... " - echo -n "baseimage... " && git clone git@github.com:avatao-content/${BASEIMAGE}.git >> $LOGFILE 2>&1 - echo -n "frontend... " && git clone git@github.com:avatao-content/${FRONTEND}.git >> $LOGFILE 2>&1 - echo -n "test... " && git clone git@github.com:avatao-content/${TEST}.git >> $LOGFILE 2>&1 + 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 "Done!" } install_frontend_deps() { echo -n "Installing frontend dependencies... " - cd "$FRONTEND" - yarn install >> $LOGFILE 2>&1 - cd .. + pushd "$FRONTEND" + logged yarn install + popd echo "Done!" } @@ -65,10 +70,10 @@ pin_latest_baseimage() build_latest_baseimage() { echo -n "Building baseimage at ${LATESTTAG}... " - cd "$BASEIMAGE" - git checkout "$LATESTTAG" >> $LOGFILE 2>&1 - cd .. - TFWTAG=$LATESTTAG ${TEST}/hack/tfw.sh buildtfw >> $LOGFILE 2>&1 + pushd "$BASEIMAGE" + logged git checkout "$LATESTTAG" + popd + TFWTAG=$LATESTTAG logged ${TEST}/hack/tfw.sh buildtfw echo "Done!" }