#!/bin/bash echo "SIK WEB 2.0" echo "This script will set up the environment for this project." echo "=========================================================" echo "Dependencies: python>3.5" INTERACTIVE="true" USE_NPM="true" if [[ $* == *--no-input* ]] then INTERACTIVE="false" fi if [[ $* == *--no-npm* ]] then USE_NPM="false" fi $INTERACTIVE || (echo "Running in non-interactive mode." && env) $INTERACTIVE && read -p "Are these programs installed? [y/n]" -n 1 -r || REPLY="y" echo "" if [[ ! $REPLY =~ ^[Yy]$ ]] then echo "Please install the dependencies. Exiting." exit 0 fi $INTERACTIVE && read -p "Is virtualenv activated? [y/n]" -n 1 -r || REPLY="y" echo "" if [[ ! $REPLY =~ ^[Yy]$ ]] then echo "Please activate virtualenv first. Exiting." exit 0 fi $INTERACTIVE && read -p "Copy settings from template? (recommended) [y/n]" -n 1 -r || REPLY="y" echo "" if [[ $REPLY =~ ^[Yy]$ ]] then cp "$PWD/sikweb/settings-sample.py" "$PWD/sikweb/settings.py" fi $INTERACTIVE && read -p "Copy pre-push hook to .git/hooks? (recommended) [y/n]" -n 1 -r || REPLY="y" echo "" if [[ $REPLY =~ ^[Yy]$ ]] then cp "$PWD/scripts/git/pre-push" "$PWD/.git/hooks/pre-push" fi $INTERACTIVE && read -p "Start setup? [y/n]" -n 1 -r || REPLY="y" echo "" if [[ ! $REPLY =~ ^[Yy]$ ]] then echo "Exiting." exit 0 fi set -e set -x pip install -r requirements.txt $USE_NPM && npm install python manage.py migrate python manage.py createdefaultadmin set +e set +x echo "Done." echo "Run 'python manage.py runserver 0.0.0.0:8000' to start the development server!"