Skip to content

Commit

Permalink
Replaced with if stmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailyumanov committed Mar 10, 2021
1 parent eeeafc4 commit cfb64aa
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 55 deletions.
1 change: 1 addition & 0 deletions deploy_local_beta/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ unset ANYBETA_VENV_ACTIVATE
unset ANYBETA_REPORT_PREFIX
unset ANYBETA_ERROR_PREFIX
unset ANYBETA_SAVE_VENV
unset ANYBETA_correct_args

unset ANYBETA_report
unset ANYBETA_error
Expand Down
71 changes: 22 additions & 49 deletions deploy_local_beta/deploy_local_beta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,38 @@ if ! test $ANYBETA_ROOT
then
echo "ERROR: This file should not be run directly."
echo "Execute \`. deploy_local_beta/run.sh\` from repository root instead."
exit 1
fi


# PARSE ARGS
############

while (( "$#" )); do
ANYBETA_PARAM=`echo $1 | awk -F= '{ print $1 }'`
ANYBETA_VALUE=`echo $1 | awk -F= '{ print $2 }'`

case $ANYBETA_PARAM in
-p|--python-path)
ANYBETA_PYTHON_PATH=$ANYBETA_VALUE
shift
;;
else

-h|--help)
ANYBETA_usage
exit 0
;;

*)
echo "Error: unknown parameter $ANYBETA_PARAM"
exit 1
;;
esac
done
# CHECK PYTHON PATH
###################

# if ! test -e $ANYBETA_PYTHON_PATH
# then
# ANYBETA_error "Bad python path: $ANYBETA_PYTHON_PATH"
# else

# CHECK PYTHON PATH
###################

if ! test -e $ANYBETA_PYTHON_PATH
then
ANYBETA_error "Bad python path: $ANYBETA_PYTHON_PATH"
exit 1
fi
# CLONE REPOSITORY
##################

ANYBETA_report
ANYBETA_report "Init submodules"
git submodule init
git submodule update

# CLONE REPOSITORY
##################

ANYBETA_report
ANYBETA_report "Init submodules"
git submodule init
git submodule update
# CHOOSE RIGHT VERSION
######################

ANYBETA_PYTHON_VERSION_CHECK="from __future__ import print_function; import sys; print(int(sys.version_info < (3, 3)))"

# CHOOSE RIGHT VERSION
######################
if test `$ANYBETA_PYTHON_PATH -c "$ANYBETA_PYTHON_VERSION_CHECK"` -eq 1
then
. $ANYBETA_DEPLOY/deploy_local_beta_python2.sh
else
. $ANYBETA_DEPLOY/deploy_local_beta_python3.sh
fi

ANYBETA_PYTHON_VERSION_CHECK="from __future__ import print_function; import sys; print(int(sys.version_info < (3, 3)))"

if test `$ANYBETA_PYTHON_PATH -c "$ANYBETA_PYTHON_VERSION_CHECK"` -eq 1
then
. $ANYBETA_DEPLOY/deploy_local_beta_python2.sh
else
. $ANYBETA_DEPLOY/deploy_local_beta_python3.sh
fi


10 changes: 5 additions & 5 deletions deploy_local_beta/deploy_local_beta_python2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ if ! test $ANYBETA_ROOT
then
echo "ERROR: This file should not be run directly."
echo "Execute \`. deploy_local_beta/run.sh\` from repository root instead."
exit 1
fi
else


#SETUP VIRTUALENV
Expand All @@ -33,7 +32,8 @@ pip install -r requirements_local.txt

ANYBETA_report
ANYBETA_report "Manage django project"
$ANYBETA_PYTHON_PATH setup.py develop
./anytask/manage.py
./anytask/manage.py migrate --noinput
python setup.py develop
python ./anytask/manage.py migrate --noinput
#./anytask/manage.py runserver 127.0.0.1:8019 -v 3 --traceback

fi
34 changes: 33 additions & 1 deletion deploy_local_beta/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,36 @@ function ANYBETA_usage() {

export -f ANYBETA_report ANYBETA_error ANYBETA_usage

$ANYBETA_DEPLOY/deploy_local_beta.sh "$@"

# PARSE ARGS
############

ANYBETA_correct_args=1

while (( "$#" )); do
ANYBETA_PARAM=`echo $1 | awk -F= '{ print $1 }'`
ANYBETA_VALUE=`echo $1 | awk -F= '{ print $2 }'`

case $ANYBETA_PARAM in
-p|--python-path)
ANYBETA_PYTHON_PATH=$ANYBETA_VALUE
shift
;;

-h|--help)
ANYBETA_usage
shift
;;

*)
ANYBETA_error "Error: unknown parameter $ANYBETA_PARAM"
shift
ANYBETA_correct_args=0
;;
esac
done

if test $ANYBETA_correct_args = 1
then
. $ANYBETA_DEPLOY/deploy_local_beta.sh "$@"
fi

0 comments on commit cfb64aa

Please sign in to comment.