6
0
Fork 0

Paar eerste scripts tbv toekomstige kwaliteitscontrole

This commit is contained in:
Michael Boelen 2023-06-24 14:07:26 +02:00
parent b8b6fba922
commit 80821d2d50
3 changed files with 46 additions and 0 deletions

25
scripts/check-all-links.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh
set -eu
if [ -f ./check-all-links.tmp ]; then rm ./check-all-links.tmp; fi
if [ -d ./public ]; then
grep -ri --only-matching --no-filename "https://[a-zA-Z0-9]*\.\([a-z0-9\.\_/~-]\)*" ./public | grep "^http" | sed 's/\\n.*//g' | sort --unique > check-all-links.tmp
for URL in $(cat ./check-all-links.tmp); do
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "${URL}")
if [ ! "${HTTP_CODE}" = "200" ]; then
echo "[WARNING] ${URL} (HTTP: ${HTTP_CODE})"
fi
sleep 5
done
else
echo "Dit script dient gedraaid te worden in de hoofddirectory van de website."
exit 1
fi
if [ -f ./check-all-links.tmp ]; then rm ./check-all-links.tmp; fi
exit 0
# EOF

7
scripts/check-canary.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
set -eu
grep -r '🐦' ./public
grep -ri 'placeholder' ./public

14
scripts/check-spelling.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
set -eu
if [ -d ./public ]; then
find ./public -name "*.html" -exec sed -e "s/<[^>]*>/ /g" {} + > plaintext.txt
if [ -f plaintext.txt ]; then
aspell --lang=nl check plaintext.txt
fi
else
echo "Run from root directory of website project. Something like ./scripts/$0"
fi
# EOF