Push Jekyll site files into a subdirectory to avoid confusing them with actual dots script files

This commit is contained in:
Danielle McLean 2020-06-18 12:00:16 +10:00
parent b9d9939c7f
commit 0207b7da11
Signed by: 00dani
GPG key ID: 9DDE1EDE01E3A605
12 changed files with 5 additions and 9 deletions

28
site/_scripts/partial-dl-test Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env zsh
actualSize=$(wc -c < $1)
testDir=$TMPDIR/dots-partial-dl-test-$UID-$$
if [[ -d $testDir ]]; then
echo "$testDir exists, is this test already running?" >&2
echo "Refusing to launch. Remove $testDir manually if necessary." >&2
exit -1
fi
repeat-char() {
local char=$1
local -i count=$2
(( count )) && printf "$char%.0s" {1..$count}
}
for (( size = 0; size < actualSize - 1; size++ )); do
percent=$(( size * 100 / actualSize ))
progress=$(( percent / 10 ))
printf " [%-10s] [%${#actualSize}d/%d]\r" "$(repeat-char = $progress)" $size $actualSize >&2
head -c$size $1 | env -i HOME=$testDir zsh 2>/dev/null
if [[ -d $testDir ]]; then
rm -rf $testDir
printf "\ndots still ran with only %d bytes available, %d%% of its full %d bytes!\n" $size $percent $actualSize >&2
exit $size
fi
done