Add pre-commit hook

This commit is contained in:
Jan Tuomi
2017-11-25 21:49:30 +02:00
parent e4f701711c
commit ec6051d3d6
2 changed files with 14 additions and 2 deletions
+4
View File
@@ -0,0 +1,4 @@
set -e
npm test
python manage.py test
set +e
+10 -2
View File
@@ -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 ""