1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-11-14 02:57:18 +00:00

Strip bootstrap.sh from tfw.sh as Dockerization efforts are abandoned

This commit is contained in:
Kristóf Tóth 2018-06-27 13:57:00 +02:00
parent 7567bcb891
commit 043ae95801
4 changed files with 47 additions and 37 deletions

View File

@ -1,15 +1,20 @@
#!/usr/bin/env bash
set -eu
set -o pipefail
set -o errtrace
shopt -s expand_aliases
[ "$(uname)" == "Darwin" ] && alias sed="gsed" || :
HERE="$(pwd)"
CHALLENGE=${CHALLENGE:-test-tutorial-framework}
BASEIMAGE_NAME="${BASEIMAGE_NAME:-eu.gcr.io/avatao-challengestore/tutorial-framework}"
BASEIMAGE_REPO="${BASEIMAGE_REPO:-baseimage-tutorial-framework}"
FRONTEND_REPO="${FRONTEND_REPO:-frontend-tutorial-framework}"
LOGFILE=/tmp/bootstrap_tfw.log
REMOTEBASE="git@github.com:avatao-content"
libhack_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "${libhack_dir}/common.sh"
source "${libhack_dir}/baseimage.sh"
bootstrap::run() {
run() {
trap 'exit 1' INT
trap handle_exit EXIT
: > "${LOGFILE}"
@ -17,7 +22,7 @@ bootstrap::run() {
check_dependencies
clone_required_repos_ask_ssh_or_https
local tag
tag="${BASEIMAGE_ONLY:-$(remotebase="${REMOTEBASE}" baseimage::latest_upstream_tag)}"
tag="${BASEIMAGE_ONLY:-$(remotebase="${REMOTEBASE}" baseimage_latest_upstream_tag)}"
tag=${tag} build_baseimage
if [ -z "${BASEIMAGE_ONLY:-}" ]; then
@ -108,6 +113,14 @@ install_frontend_deps() {
echo "Done!"
}
baseimage_latest_upstream_tag() {
echo -n "$(git ls-remote --tags ${remotebase}/${BASEIMAGE_REPO}.git |
cut -f2 |
grep -oP '(?<=refs/tags/)\w+-\d{8}$' |
sort -t '-' -k2 |
tail -n 1)"
}
pin_baseimage() {
echo -n "Pinning TFW baseimage version... "
echo -n "which is ${tag}... "
@ -137,3 +150,29 @@ merge_repos() {
mv "${FRONTEND_REPO}" "${NESTED_FRONTEND}"
echo "Done!"
}
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"
wait $pid
}
pushd() {
command pushd "$@" > /dev/null
}
popd() {
command popd "$@" > /dev/null
}
run

View File

@ -67,14 +67,6 @@ baseimage::builddocs() {
fi
}
baseimage::latest_upstream_tag() {
echo -n "$(git ls-remote --tags ${remotebase}/${BASEIMAGE_REPO}.git |
cut -f2 |
grep -oP '(?<=refs/tags/)\w+-\d{8}$' |
sort -t '-' -k2 |
tail -n 1)"
}
releasename() {
local version
local date

View File

@ -5,19 +5,3 @@ pushd() {
popd() {
command popd "$@" > /dev/null
}
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"
wait $pid
}

View File

@ -3,7 +3,7 @@ set -eu
set -o pipefail
set -o errtrace
shopt -s expand_aliases
[ "$(uname)" == "Darwin" ] && alias readlink="greadlink" && alias sed="gsed" || :
[ "$(uname)" == "Darwin" ] && alias readlink="greadlink" || :
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
TFW_PATH="${TFW_PATH:-$SCRIPT_DIR/../..}"
@ -19,7 +19,6 @@ FRONTEND_PATH="${TFW_PATH}/${FRONTEND_REPO}"
source "${SCRIPT_DIR}/libhack/baseimage.sh"
source "${SCRIPT_DIR}/libhack/challenge.sh"
source "${SCRIPT_DIR}/libhack/frontend.sh"
source "${SCRIPT_DIR}/libhack/bootstrap.sh"
start_challenge_and_frontend() {
@ -32,9 +31,6 @@ start_challenge_and_frontend() {
}
case ${1:-} in
bootstrap)
bootstrap::run
;;
start)
baseimage::build_if_exists
BUILD=1 RUN_FRONTEND=1 start_challenge_and_frontend ${@:2}
@ -75,7 +71,6 @@ case ${1:-} in
;;
*)
echo "Usage: tfw.sh [COMMAND]"
echo " |--- bootstrap: setup TFW development environment"
echo " |--- start: build & run TFW challenge and Angular frontend"
echo " |--- run: run TFW challenge and Angular frontend"
echo " |--- startcontainer: build & run TFW challenge, container only"