-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# encoding: UTF-8 | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# More info at https://github.com/guard/guard#readme | ||
|
||
# Style Tests | ||
# =========== | ||
# - Foodcritic | ||
# - RuboCop | ||
|
||
group :style, | ||
halt_on_fail: true do | ||
guard :foodcritic, | ||
cli: '--exclude test/unit', | ||
cookbook_paths: '.', | ||
all_on_start: false do | ||
watch(%r{attributes/.+\.rb$}) | ||
watch(%r{definitions/.+\.rb$}) | ||
watch(%r{libraries/.+\.rb$}) | ||
watch(%r{providers/.+\.rb$}) | ||
watch(%r{recipes/.+\.rb$}) | ||
watch(%r{resources/.+\.rb$}) | ||
watch(%r{templates/.+\.erb$}) | ||
watch('metadata.rb') | ||
end | ||
|
||
guard :rubocop, | ||
all_on_start: false do | ||
watch(/.+\.rb$/) | ||
watch('Gemfile') | ||
watch('Rakefile') | ||
watch('Capfile') | ||
watch('Guardfile') | ||
watch('Podfile') | ||
watch('Thorfile') | ||
watch('Vagrantfile') | ||
watch('Berksfile') | ||
watch('Cheffile') | ||
watch('Vagabondfile') | ||
end | ||
end # group style | ||
|
||
# Unit Tests | ||
# ========== | ||
# - test/unit/libraries/${library}_spec.rb: Unit tests for libraries. | ||
# - test/unit/recipes/${recipe}_spec.rb: ChefSpec tests for recipes. | ||
# - test/unit/resources/${resource}_spec.rb: ChefSpec tests for resources. | ||
|
||
group :unit do | ||
guard :rspec, | ||
cmd: 'bundle exec rake unit', | ||
all_on_start: false do | ||
watch(%r{^libraries/(.+)\.rb$}) do |m| | ||
"test/unit/libraries/#{m[1]}_spec.rb" | ||
end | ||
watch(%r{^recipes/(.+)\.rb$}) { |m| "test/unit/recipes/#{m[1]}_spec.rb" } | ||
watch(%r{^(?:providers|resources)/(.+)\.rb$}) do |m| | ||
"test/unit/resources/#{m[1]}_spec.rb" | ||
end | ||
watch(%r{^test/unit/.+_spec\.rb$}) | ||
watch('test/unit/spec_helper.rb') { 'spec' } | ||
end | ||
end # group unit | ||
|
||
# Integration Tests | ||
# ================= | ||
# - test-kitchen | ||
# | ||
# Temporary disabled. See the Gemfile. | ||
|
||
# group :integration do | ||
# guard 'kitchen', | ||
# all_on_start: false do | ||
# watch(%r{attributes/.+\.rb$}) | ||
# watch(%r{definitions/.+\.rb$}) | ||
# watch(%r{libraries/.+\.rb$}) | ||
# watch(%r{providers/.+\.rb$}) | ||
# watch(%r{recipes/.+\.rb$}) | ||
# watch(%r{resources/.+\.rb$}) | ||
# watch(%r{files/.+}) | ||
# watch(%r{templates/.+\.erb$}) | ||
# watch('metadata.rb') | ||
# watch(%r{test/.+$}) | ||
# watch('Berksfile') | ||
# end | ||
# end # group integration | ||
|
||
scope groups: [:style, :unit] |