Update pre-commit script
This commit is contained in:
@@ -30,6 +30,7 @@ Set up your SSH key authentication in GitLab Profile Settings. Then clone the re
|
|||||||
git clone git@git.sahkoinsinoorikilta.fi:vtmk/web2.0.git
|
git clone git@git.sahkoinsinoorikilta.fi:vtmk/web2.0.git
|
||||||
cd web2.0
|
cd web2.0
|
||||||
git checkout develop
|
git checkout develop
|
||||||
|
cp scripts/git/pre-commit .git/hooks/pre-commit # install a script to test code before committing
|
||||||
```
|
```
|
||||||
|
|
||||||
## Windows install instructions
|
## Windows install instructions
|
||||||
|
|||||||
+14
-7
@@ -1,17 +1,24 @@
|
|||||||
. "VIRTUALENV_ACTIVATE"
|
#!/bin/bash
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
|
||||||
echo "Failed to source virtualenv. Skipping pre-commit hook."
|
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -e
|
|
||||||
PURPLE='\033[0;35m'
|
PURPLE='\033[0;35m'
|
||||||
NC='\033[0m' # No Color
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
. "${VIRTUAL_ENV}/bin/activate"
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
printf "${PURPLE}Failed to find virtualenv. Skipping pre-commit hook.\n${NC}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
printf "${PURPLE}Running pre-commit tests.${NC}\n"
|
printf "${PURPLE}Running pre-commit tests.${NC}\n"
|
||||||
|
printf "${PURPLE}npm tests...${NC}\n"
|
||||||
npm test
|
npm test
|
||||||
|
printf "${PURPLE}pycodestyle tests...${NC}\n"
|
||||||
pycodestyle .
|
pycodestyle .
|
||||||
|
printf "${PURPLE}unit tests...${NC}\n"
|
||||||
python manage.py test --noinput
|
python manage.py test --noinput
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user