diff options
Diffstat (limited to 'pre-push.sh')
-rw-r--r-- | pre-push.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/pre-push.sh b/pre-push.sh new file mode 100644 index 0000000..8e3b244 --- /dev/null +++ b/pre-push.sh @@ -0,0 +1,33 @@ +#! /bin/sh +# create and sanitise files for pushing to repo +# Philip Sargent 2020/06/20 +echo deprecations. +python -Wall manage.py check -v 3 2>deprecations.txt >/dev/null +echo diffsettings. +python manage.py diffsettings | grep "###" > diffsettings.txt +echo pip freeze. +pip freeze > requirements.txt +echo inspectdb. +python manage.py inspectdb > troggle-inspectdb.py +#egrep -in "unable|error" troggle-inspectdb.py +echo remove passwords. +cp localsettings.py localsettingsWSL.py +grep EXPOUSERPASS localsettings*.py +sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg"/' localsettings*.py +sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg"/' diffsettings.txt +echo " " reset: EXPOUSERPASS = \"nnn:gggggg\" +grep EMAIL_HOST_PASSWORD localsettings*.py +sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "insert-real-email-password-here"/' localsettings*.py +sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "insert-real-email-password-here"/' diffsettings.txt +echo " " reset: EMAIL_HOST_PASSWORD = \"insert-real-email-password-here\" +grep SECRET_KEY *settings.* +sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"/' settings.py +sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"/' diffsettings.txt +echo " " reset: SECRET_KEY = \"not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2\" +# +# Do these before final testing, *not* just before pushing: +# python reset-django.py +# python manage.py makemigrations +# python manage.py test +# python manage.py inspectdb > troggle-inspectdb.py +# egrep -i "unable|error" troggle-inspectdb.py |