From ec6051d3d6a95a82dd26b933bfdd059a4af07ca4 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sat, 25 Nov 2017 21:49:30 +0200 Subject: [PATCH] Add pre-commit hook --- scripts/git/pre-commit | 4 ++++ setup.sh | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 scripts/git/pre-commit diff --git a/scripts/git/pre-commit b/scripts/git/pre-commit new file mode 100755 index 0000000..8cad847 --- /dev/null +++ b/scripts/git/pre-commit @@ -0,0 +1,4 @@ +set -e +npm test +python manage.py test +set +e diff --git a/setup.sh b/setup.sh index 6ac4281..fe93c6a 100755 --- a/setup.sh +++ b/setup.sh @@ -3,7 +3,7 @@ echo "SIK WEB 2.0" echo "This script will set up the environment for this project." echo "=========================================================" -echo "Dependencies: postgresql>9.5, python>3.5" +echo "Dependencies: python>3.5" INTERACTIVE="true" USE_NPM="true" @@ -27,7 +27,7 @@ then exit 0 fi -$INTERACTIVE && read -p "Create user 'sik' in postgres (needs sudo) [y/n]?" -n 1 -r || REPLY="n" +$INTERACTIVE && read -p "Create user 'sik' in database (needs sudo) [y/n]?" -n 1 -r || REPLY="n" echo "" if [[ $REPLY =~ ^[Yy]$ ]] @@ -52,6 +52,14 @@ then cp "$PWD/sikweb/settings-sample.py" "$PWD/sikweb/settings.py" fi +$INTERACTIVE && read -p "Copy pre-commit hook to .git/hooks? [y/n]" -n 1 -r || REPLY="y" +echo "" + +if [[ $REPLY =~ ^[Yy]$ ]] +then + cp "$PWD/scripts/git/pre-commit" "$PWD/.git/hooks/pre-commit" +fi + $INTERACTIVE && read -p "Start setup? [y/n]" -n 1 -r || REPLY="y" echo ""