Skip to content

Commit

Permalink
Update guard config to match other gems
Browse files Browse the repository at this point in the history
  • Loading branch information
dkubb committed Jul 23, 2013
1 parent bace36c commit 55c3e7c
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions Guardfile
Expand Up @@ -2,17 +2,31 @@

guard :bundler do
watch('Gemfile')
watch('Gemfile.lock')
watch(%w{.+.gemspec\z})
end

guard :rspec do
# run all specs if the spec_helper or supporting files files are modified
watch('spec/spec_helper.rb') { 'spec' }
watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec' }
guard :rspec, cli: File.read('.rspec').split.join(' '), keep_failed: false do
# Run all specs if configuration is modified
watch('.rspec') { 'spec' }
watch('Guardfile') { 'spec' }
watch('Gemfile.lock') { 'spec' }
watch('spec/spec_helper.rb') { 'spec' }

# run unit specs if associated lib code is modified
watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}"] }
watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' }
# Run all specs if supporting files files are modified
watch(%r{\Aspec/(?:fixtures|lib|support|shared)/.+\.rb\z}) { 'spec' }

# run a spec if it is modified
# Run unit specs if associated app or lib code is modified
watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}*"] }
watch(%r{\Alib/(.+)/support/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}/#{m[2]}*"] }
watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' }

# Run a spec if it is modified
watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
end

guard :rubocop, cli: %w[--config config/rubocop.yml] do
watch(%r{.+\.(?:rb|rake)\z})
watch(%r{\Aconfig/rubocop\.yml\z}) { |m| File.dirname(m[0]) }
watch(%r{(?:.+/)?\.rubocop\.yml\z}) { |m| File.dirname(m[0]) }
end

0 comments on commit 55c3e7c

Please sign in to comment.