Skip to content

Instantly share code, notes, and snippets.

@SeedyROM
Created May 10, 2017 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SeedyROM/d667698d3f2795d8cd54404ca3d4d5c4 to your computer and use it in GitHub Desktop.
Save SeedyROM/d667698d3f2795d8cd54404ca3d4d5c4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#
# A simple script to setup the development env.
#
ENV_NAME="env"
DEPS_FILE="requirements.txt"
if [[ $# -eq 1 ]]; then
if [[ $1 -eq "update_deps_file" ]]; then
if [[ ! $(cat $DEPS_FILE) == $(pip freeze) ]]; then
rm $DEPS_FILE
pip freeze > $DEPS_FILE
else
echo "No new dependencies to add to $DEPS_FILE..."
exit 1
fi
fi
else
if [[ ! -d "$ENV_NAME" ]]; then
virtualenv -p python3 $ENV_NAME > /dev/null
. $ENV_NAME/bin/activate
pip install --upgrade pip > /dev/null
pip install -r requirements.txt
if ! grep -Fqx "$ENV_NAME/" .gitignore
then
echo "$ENV_NAME/" >> .gitignore
fi
echo
echo "Enviroment setup sucessful!"
exit $?
else
echo "Development environment already exists..."
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment