2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 10:26:17 +00:00

fixing pre-run script

This commit is contained in:
2024-12-12 17:08:00 +00:00
parent 58c9dd7d09
commit 321f912083
4 changed files with 33 additions and 60 deletions

View File

@@ -1,35 +1,36 @@
#! /bin/sh
#! /bin/bash
# Do these before final testing, *not* just before pushing:
# Philip Sargent 2020/06/20
# now with uv
PYTHON="uv run"
cd ..
# Need to be in an ALREADY activated venv
PYTHON="python"
echo "** Run inspectdb:"
$PYTHON troggle/manage.py inspectdb > troggle-inspectdb.py
$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$" | grep -v "/migrations/" |grep -v "troggle-inspectdb.py"| awk -F ":" '{ sum +=$2; print $2, $1; } END {print sum}'| sort -n > lines-of-python.txt
# 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
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
echo "** Run reset-django.py - which deletes the database"
# This deletes the database so must run after generating troggle-inspectdb.py
$PYTHON troggle/reset-django.py
$PYTHON reset-django.py
echo "** After cleanup deletion, remake all migrations."
$PYTHON troggle/manage.py makemigrations >/dev/null
$PYTHON troggle/manage.py migrate
$PYTHON manage.py makemigrations >/dev/null
$PYTHON manage.py migrate
echo "** Now running self check"
$PYTHON troggle/manage.py check -v 3 --deploy 2>security-warnings.txt >/dev/null
$PYTHON troggle/manage.py check -v 3 --deploy
$PYTHON manage.py check -v 3 --deploy 2>security-warnings.txt >/dev/null
$PYTHON manage.py check -v 3 --deploy
echo "** Now running test suite"
$PYTHON troggle/manage.py test -v 1
# $PYTHON manage.py test -v 1
echo ""
echo `tail -1 lines-of-python.txt` non-comment lines of python.
echo `tail -1 lines-of-python.txt` non-comment lines of python. But core/utils.py has 28,000 lines of numbers.
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 ?'