2024-12-12 17:08:00 +00:00
|
|
|
#! /bin/bash
|
2020-06-20 15:43:28 +01:00
|
|
|
# Do these before final testing, *not* just before pushing:
|
2024-12-12 17:08:00 +00:00
|
|
|
# Need to be in an ALREADY activated venv
|
|
|
|
PYTHON="python"
|
|
|
|
|
2022-10-27 16:29:11 +01:00
|
|
|
echo "** Run inspectdb:"
|
2024-12-12 17:08:00 +00:00
|
|
|
$PYTHON manage.py inspectdb > troggle-inspectdb.py
|
2020-06-20 15:43:28 +01:00
|
|
|
# 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
|
|
|
|
|
2024-12-12 17:08:00 +00:00
|
|
|
# fix this as core/utils.py has 28,000 lines of numbers.
|
|
|
|
find . -name \*.html -print0 | xargs -0 egrep -vc "#|^\s*$" | grep -v ":0$" | grep -v ".venv" | awk -F ":" '{ sum +=$2; print $2, $1; } END {print sum}'| sort -n > lines-of-templates.txt
|
2020-06-20 23:08:34 +01:00
|
|
|
|
2024-12-12 17:08:00 +00:00
|
|
|
find . -name \*.py -print0 | xargs -0 egrep -vc "#|^\s*$" | grep -v ":0$" | grep -v ".venv" | grep -v "/migrations/" |grep -v "troggle-inspectdb.py"| awk -F ":" '{ sum +=$2; print $2, $1; } END {print sum}'| sort -n > lines-of-python.txt
|
2020-06-20 17:19:50 +01:00
|
|
|
|
2024-12-12 17:08:00 +00:00
|
|
|
echo "** Run reset-django.py - which deletes the database"
|
2020-06-20 17:19:50 +01:00
|
|
|
# This deletes the database so must run after generating troggle-inspectdb.py
|
2024-12-12 17:08:00 +00:00
|
|
|
$PYTHON reset-django.py
|
2022-10-27 16:29:11 +01:00
|
|
|
echo "** After cleanup deletion, remake all migrations."
|
2024-12-12 17:08:00 +00:00
|
|
|
$PYTHON manage.py makemigrations >/dev/null
|
|
|
|
$PYTHON manage.py migrate
|
2022-10-27 16:29:11 +01:00
|
|
|
|
|
|
|
echo "** Now running self check"
|
2024-12-12 17:08:00 +00:00
|
|
|
$PYTHON manage.py check -v 3 --deploy 2>security-warnings.txt >/dev/null
|
|
|
|
$PYTHON manage.py check -v 3 --deploy
|
2022-10-27 16:29:11 +01:00
|
|
|
|
|
|
|
echo "** Now running test suite"
|
2024-12-12 17:08:00 +00:00
|
|
|
# $PYTHON manage.py test -v 1
|
2022-10-27 16:29:11 +01:00
|
|
|
|
2020-06-20 23:08:34 +01:00
|
|
|
echo ""
|
2024-12-12 17:08:00 +00:00
|
|
|
echo `tail -1 lines-of-python.txt` non-comment lines of python. But core/utils.py has 28,000 lines of numbers.
|
2021-03-24 20:38:43 +00:00
|
|
|
echo `tail -1 lines-of-templates.txt` non-comment lines of HTML templates.
|
2021-11-05 21:01:10 +00:00
|
|
|
|
2022-10-27 16:29:11 +01:00
|
|
|
echo '** If you have an error running manage.py, maybe you are not in an activated venv ?'
|