You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
600 B
Bash
30 lines
600 B
Bash
3 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||
|
set -euo pipefail
|
||
|
IFS=$'\n\t'
|
||
|
|
||
|
# Pre-configuration
|
||
|
|
||
|
# Set working directory to root
|
||
|
cd "$(dirname "$0")/../"
|
||
|
CDIR=$(pwd -P)
|
||
|
export CDIR
|
||
|
|
||
|
VIRTUAL_ENV="${VIRTUAL_ENV:-}"
|
||
|
REQUIREMENTS="${CDIR}/backend/requirements.txt"
|
||
|
DEV_REQUIREMENTS="${CDIR}/dev_requirements.txt"
|
||
|
|
||
|
function sync_env () {
|
||
|
if [ -z "${VIRTUAL_ENV}" ]; then
|
||
|
echo "warning: you are not in a virtualenv. Skipping sync."
|
||
|
exit 1
|
||
|
else
|
||
|
echo "Syncing virtualenv"
|
||
|
pip-sync $REQUIREMENTS $DEV_REQUIREMENTS
|
||
|
fi
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
sync_env
|