improvement(builder): make regex more specific
So it matches `.git` but not `..git..`. Also makes a few other tweaks: - ignore 4913 from watching: vim creates this sometimes - improve inotifywait command
This commit is contained in:
parent
1d0180893a
commit
ee0430be61
1 changed files with 8 additions and 3 deletions
11
builder.sh
11
builder.sh
|
@ -7,7 +7,12 @@ cmd="--html-url-extension-style=indexify site.yml"
|
|||
srcdir="modules"
|
||||
buildir="public"
|
||||
previewpidfile="preview.pid"
|
||||
inotifyignore=".git*"
|
||||
|
||||
# 4913: for vim users, vim creates a temporary file to test it can write to
|
||||
# directory
|
||||
# https://groups.google.com/g/vim_dev/c/sppdpElxY44
|
||||
# .git: so we don't get rebuilds each time git metadata changes
|
||||
inotifyignore="\.git.*|4913"
|
||||
|
||||
watch_and_build () {
|
||||
if ! command -v inotifywait > /dev/null
|
||||
|
@ -29,12 +34,12 @@ watch_and_build () {
|
|||
# temporary files that are updated regularly and so on, so better
|
||||
# to get the list from git. It'll also look at global gitingore
|
||||
# settings and so on.
|
||||
inotifyignore="$(git status -s --ignored | grep '^!!' | sed -e 's/^!! //' -e 's:/:\*:' | tr '\n' '|')${inotifyignore}"
|
||||
inotifyignore="$(git status -s --ignored | grep '^!!' | sed -e 's/^!! //' | tr '\n' '|')${inotifyignore}"
|
||||
fi
|
||||
|
||||
while true
|
||||
do
|
||||
echo "Watching current directory (excluding ${inotifyignore}) for changes and re-building as required. Use Ctrl C to stop."
|
||||
echo "Watching current directory (excluding: ${inotifyignore}) for changes and re-building as required. Use Ctrl C to stop."
|
||||
inotifywait -q --exclude "($inotifyignore)" -e modify,create,delete,move -r . && echo "Change detected, rebuilding.." && build
|
||||
done
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue