samhuri.net/bin/watch

17 lines
367 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
BLOG_TARGET=${BLOG_TARGET:-mudge}
if ! command -v inotifywait >/dev/null 2>/dev/null; then
echo "inotifywait is required (install inotify-tools)."
exit 1
fi
while true; do
inotifywait -e modify,create,delete,move -r public -r posts -r lib
echo "changed at $(date)"
sleep 2
rbenv exec bundle exec bake "$BLOG_TARGET"
done