Little niceties around development process.

This commit is contained in:
Jonathan Bernard 2019-08-04 22:53:58 -05:00
parent 9660dfda3f
commit eeebc91723
3 changed files with 62 additions and 5 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
*.sw?
dist/

View File

@ -1,7 +1,15 @@
deploy:
-rm -r dist
mkdir dist
cp flashcards.* dist
git describe --always --tags | xargs --replace=INSERTED -- sed -i -e 's/%VERSION%/INSERTED/' dist/*
deploy: clean build
aws s3 sync dist s3://flashcards.jdbernard.com
rm -r dist
serve-local:
(cd dist && python -m SimpleHTTPServer &)
./makewatch build
build: flashcards.*
-mkdir dist
cp flashcards.* dist
git describe --always --dirty --tags | xargs --replace=INSERTED -- sed -i -e 's/%VERSION%/INSERTED/' dist/*
clean:
-rm -r dist

48
makewatch Normal file
View File

@ -0,0 +1,48 @@
#!/bin/bash -e
# Don Marti <dmarti@zgp.org>
# (If you need a license on this in order to use it,
# mail me and I'll put a license on it. Otherwise,
# de minimis non curat lex.)
# re-run make, with the supplied arguments, when a
# Makefile prerequisite changes. Example:
# makewatch test
# Fun to use with Auto Reload (Firefox) or Tincr (Chrome) and Pandoc
# https://addons.mozilla.org/en-US/firefox/addon/auto-reload/
# http://tin.cr/
# http://johnmacfarlane.net/pandoc/
# Requires inotifywait. Probably requires GNU Make to
# get the right "-dnr" output. Not tested with other
# "make" implementations
# If $MAKEWATCH is set to an existing file or
# space-separated list of files, also checks those.
make_prereqs() {
# Make "make" figure out what files it's interested in.
echo "Makefile"
find $MAKEWATCH
gmake -dnr $* | tr ' ' '\n' | \
grep ".*'.$" | grep -o '\w.*\b'
}
prereq_files() {
# prerequisites mentioned in a Makefile
# that are extant files
echo ' '
for f in `make_prereqs $* | sort -u`; do
[ -e $f ] && echo -n "$f ";
done
echo
}
make $*
while true; do
fl=$(prereq_files $*)
ev=$(inotifywait --quiet --format %e $fl)
if [ "xOPEN" != "x$ev" ]; then
sleep 1
make $*
fi
done