Skip to content

Instantly share code, notes, and snippets.

@scarolan
Last active December 28, 2015 06:48
Show Gist options
  • Save scarolan/7459166 to your computer and use it in GitHub Desktop.
Save scarolan/7459166 to your computer and use it in GitHub Desktop.
Guardfile for testing a Chef cookbook
# Guardfile for testing this cookbook
guard :rubocop do
watch(%r{.+\.rb$})
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
guard :foodcritic, cookbook_paths: '.' do
watch(%r{attributes/.+\.rb$})
watch(%r{providers/.+\.rb$})
watch(%r{recipes/.+\.rb$})
watch(%r{resources/.+\.rb$})
end
guard :rspec do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^(recipes)/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
end
guard :kitchen, all_on_start: false do
watch(%r{test/.+})
watch(%r{^recipes/(.+)\.rb$})
watch(%r{^attributes/(.+)\.rb$})
watch(%r{^files/(.+)})
watch(%r{^templates/(.+)})
watch(%r{^providers/(.+)\.rb})
watch(%r{^resources/(.+)\.rb})
end
# These are required to work around some oddress
# Required for Growl notifications to work properly.
SafeYAML::OPTIONS[:deserialize_symbols] = true
SafeYAML::OPTIONS[:default_mode] = 'unsafe'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment