Skip to content

Commit

Permalink
Add a Guardfile
Browse files Browse the repository at this point in the history
  • Loading branch information
zuazo committed Sep 18, 2015
1 parent 85ef251 commit b818c3f
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions Guardfile
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]

0 comments on commit b818c3f

Please sign in to comment.