Skip to content

Instantly share code, notes, and snippets.

@GeoffWilliams
Created August 18, 2017 14:01
Show Gist options
  • Save GeoffWilliams/c88dedb7d5e6dee2f76121c2e2377afa to your computer and use it in GitHub Desktop.
Save GeoffWilliams/c88dedb7d5e6dee2f76121c2e2377afa to your computer and use it in GitHub Desktop.
A makefile for doing testing with onceover (rename as just Makefile) - lets you test syntax and rspec by typing `make` - ideally hoping that equivalent functionality can be incorporated into onceover at some point as the validation is very slow due to needing a new ruby interpretter for each file validated
'onceover:
bundle install
# puppet files
find . -name '*.pp' -not -path './.onceover/*' | xargs -n1 bundle exec puppet parser validate
# EPP files
find . -name '*.epp' -not -path './.onceover/*' | xargs -n1 bundle exec puppet epp validate
# ERB files
find . -name '*.erb' -not -path './.onceover/*' | xargs -n1 -I {} sh -c "erb -P -x -T '-' {} | ruby -c > /dev/null || (echo ERB syntax error in {} && exit 1) "
# YAML files
find . -name '*.yaml' -not -path './.onceover/*' | xargs -n1 -I {} ruby -ryaml -e "YAML.load_file '"{}"' "
bundle exec r10k puppetfile check
bundle exec onceover run spec
# generate documentation
cd site/profile && bundle exec puppet strings
cd site/role && bundle exec puppet strings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment