troggle-unchained/pre-run.sh
2020-06-20 16:51:07 +01:00

18 lines
869 B
Bash

#! /bin/sh
# Do these before final testing, *not* just before pushing:
# Philip Sargent 2020/06/20
python reset-django.py
echo After cleanup deletion, remake all migrations.
python manage.py makemigrations >/dev/null
python manage.py test
echo Run inspectdb:
python 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$" | awk -F ":" '{ sum +=$2; print $2, $1; } END {print sum}'| sort -n > lines-of-python.txt
echo `tail -1 lines-of-python.txt` non-comment lines of python.