Created
May 10, 2017 04:22
-
-
Save SeedyROM/d667698d3f2795d8cd54404ca3d4d5c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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