diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a6c7693 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +.PHONY: \ + all \ + clean \ + publish + +.DEFAULT_GOAL := all + +clean: + rm -f *.ign + +define genrules +$(patsubst %.yaml,%.ign,$(1)): $(1) $$(shell sed -rn 's/.*local: (.*)/\1/p' $(1)) + butane -d . $$< > $$@ + +all: $(patsubst %.yaml,%.ign,$(1)) +endef + +$(foreach t,$(wildcard *.yaml),$(eval $(call genrules,$(t)))) + +publish: \ + nvr1.ign + rsync -rti $^ files.pyrocufflink.blue:public_html/ diff --git a/butane-watch.sh b/butane-watch.sh index 56e1a55..f5440c7 100644 --- a/butane-watch.sh +++ b/butane-watch.sh @@ -2,8 +2,9 @@ # vim: set sw=4 ts=4 sts=4 et : inotifywait -e CLOSE_WRITE -m . \ - | stdbuf -o 0 grep -F .yaml \ + | stdbuf -o 0 grep -v .ign \ | while read _ _ f; do - printf 'Regenerating %s from %s ...\n' "${f%.yaml}.ign" "${f}" - butane -d . ${f} > ${f%.yaml}.ign + [ -f "${f}" ] || continue + printf '%s changed, running make ...\n' "${f}" + make && make publish done