2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 14:51:51 +00:00
troggle/pre-run.sh

32 lines
1.4 KiB
Bash
Executable File

#! /bin/sh
# Do these before final testing, *not* just before pushing:
# Philip Sargent 2020/06/20
echo "** Run inspectdb:"
python3 manage.py inspectdb > troggle-inspectdb.py
# egrep -in "unable|error" troggle-inspectdb.py
echo ""
# count non-blank lines of python and template HTML code
# includes all variants of settings.py files
find . -name \*.html -print0 | xargs -0 egrep -vc "#|^\s*$" | grep -v ":0$" | awk -F ":" '{ sum +=$2; print $2, $1; } END {print sum}'| sort -n > lines-of-templates.txt
find . -name \*.py -print0 | xargs -0 egrep -vc "#|^\s*$" | grep -v ":0$" | grep -v "/migrations/" |grep -v "troggle-inspectdb.py"| awk -F ":" '{ sum +=$2; print $2, $1; } END {print sum}'| sort -n > lines-of-python.txt
# This deletes the database so must run after generating troggle-inspectdb.py
python3 reset-django.py
echo "** After cleanup deletion, remake all migrations."
python3 manage.py makemigrations >/dev/null
python3 manage.py migrate
echo "** Now running self check"
python3 manage.py check -v 3 --deploy 2>security-warnings.txt >/dev/null
python3 manage.py check -v 3 --deploy
echo "** Now running test suite"
python3 manage.py test
echo ""
echo `tail -1 lines-of-python.txt` non-comment lines of python.
echo `tail -1 lines-of-templates.txt` non-comment lines of HTML templates.
echo '** If you have an error running manage.py, maybe you are not in an activated venv ?'