fixed checkout scripts

This commit is contained in:
Märt Kalmo
2017-03-25 11:07:33 +02:00
parent 18f6d2c113
commit c014283ed4
2 changed files with 64 additions and 6 deletions

View File

@@ -1,11 +1,45 @@
echo off
git clone https://bitbucket.org/%1/i399 .\.tmp
set USER=%1
set TAG=%2
set TMP=./.tmp
set SUB_DIR=
cd .\.tmp
if "%1" == "" (
echo Usage: %0 user_name tag
exit /b 1
)
git checkout %2
if "%TAG%" == "hw3" (
echo hw3 not implemented yet
exit /b 1
)
if %errorlevel% neq 0 exit /b %errorlevel%
if "%TAG%" == "hw4" (
echo hw4 not implemented yet
exit /b 1
)
if "%TAG%" == "hw2" (
set SUB_DIR=ng1
)
if "%SUB_DIR%" == "" (
echo unknown tag
exit /b 1
)
git clone https://bitbucket.org/%USER%/i399 %TMP%
if %errorlevel% neq 0 exit /b 1
cd %TMP%
git checkout %TAG%
if %errorlevel% neq 0 exit /b 1
cd %SUB_DIR%
call npm install

View File

@@ -2,6 +2,30 @@
set -e
git clone https://bitbucket.org/$1/i399 ./.tmp
USER=$1
TAG=$2
TMP="./.tmp"
SUB_DIR=""
(cd ./.tmp && git checkout $2 && npm install && npm start)
if [ $# -eq 0 ];then
echo "Usage: $0 <user_name> <tag>"
exit 1
fi
if [ $TAG == "hw3" ] || [ $TAG == "hw4" ]; then
echo 'not implemented yet'
exit 1
fi
if [ $TAG == "hw2" ]; then
SUB_DIR="ng1"
fi
if [ -z $SUB_DIR ]; then
echo 'unknown tag'
exit 1
fi
git clone https://bitbucket.org/$USER/i399 $TMP
(cd "$TMP" && git checkout $TAG && cd "$SUB_DIR" && npm install && npm start)