Little niceties around development process.
This commit is contained in:
parent
9660dfda3f
commit
eeebc91723
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
*.sw?
|
*.sw?
|
||||||
|
dist/
|
||||||
|
18
Makefile
18
Makefile
@ -1,7 +1,15 @@
|
|||||||
deploy:
|
deploy: clean build
|
||||||
-rm -r dist
|
|
||||||
mkdir dist
|
|
||||||
cp flashcards.* dist
|
|
||||||
git describe --always --tags | xargs --replace=INSERTED -- sed -i -e 's/%VERSION%/INSERTED/' dist/*
|
|
||||||
aws s3 sync dist s3://flashcards.jdbernard.com
|
aws s3 sync dist s3://flashcards.jdbernard.com
|
||||||
rm -r dist
|
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
48
makewatch
Normal 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
|
Loading…
x
Reference in New Issue
Block a user