diff --git a/Makefile b/Makefile index bc8669c..20decae 100644 --- a/Makefile +++ b/Makefile @@ -6,3 +6,15 @@ all: puppet-modules.tar.gz puppet-modules.tar.gz: $(MODULES) umask 022 ; tar zcvf $@ --owner=root --group=root \ --mode g-w,o=g --exclude=.git $^ + +check: + @which puppet > /dev/null 2>&1 || ( \ + echo "puppet not installed, cannot perform syntax checking" \ + 1>&2 ; exit 1 ) + @for name in `git diff --name-only`; do \ + echo $${name} | egrep '\.pp$$' > /dev/null || continue ; \ + errors="`puppet --color=false --parseonly --ignoreimport $${name}`" ; \ + [ $$? -eq 0 ] && continue ; \ + echo "syntax check failed on $${name}" 1>&2 ; \ + echo " $${errors}" 1>&2 ; \ + done \ No newline at end of file