mirror of
				https://github.com/avatao-content/test-tutorial-framework
				synced 2025-10-31 08:22:55 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| set -eo pipefail
 | |
| shopt -s expand_aliases
 | |
| 
 | |
| TFW_POSTFIX=tutorial-framework
 | |
| BASEIMAGE=baseimage-${TFW_POSTFIX}
 | |
| TEST=test-${TFW_POSTFIX}
 | |
| FRONTEND=frontend-${TFW_POSTFIX}
 | |
| LOGFILE=/tmp/bootstrap_tfw.log
 | |
| 
 | |
| [ "$(uname)" == "Darwin" ] && alias sed="gsed" || :
 | |
| 
 | |
| 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 || :
 | |
| 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 "Done!"
 | |
| 
 | |
| echo -n "Installing frontend dependencies... "
 | |
| cd ${FRONTEND}
 | |
| yarn install >> $LOGFILE 2>&1
 | |
| cd ..
 | |
| echo "Done!"
 | |
| 
 | |
| if [ -z "$TFWDEV" ]; then
 | |
|     echo -n "Pinning latest TFW baseimage version... "
 | |
|     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 -i "1 s/.*/&:${LATESTTAG}/" "${TEST}/solvable/Dockerfile"
 | |
|     echo "Done!"
 | |
| 
 | |
|     rm -rf "${TEST}/.git"
 | |
|     rm -rf "${FRONTEND}/.git"
 | |
| 
 | |
|     echo -n "Merging repositories... "
 | |
|     NESTED_FRONTEND="${TEST}/solvable/frontend"
 | |
|     rm -rf $NESTED_FRONTEND
 | |
|     mv "$FRONTEND" "$NESTED_FRONTEND"
 | |
|     echo "Done!"
 | |
| fi
 | |
| 
 | |
| echo 
 | |
| echo "You can build & start TFW by executing the command: ${TEST}/hack/tfw.sh start"
 |