2012-07-23 10:37:44 -04:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
guard :bundler do
|
|
|
|
watch('Gemfile')
|
2013-07-28 15:15:55 -04:00
|
|
|
watch('Gemfile.lock')
|
|
|
|
watch(%w{.+.gemspec\z})
|
2012-07-23 10:37:44 -04:00
|
|
|
end
|
|
|
|
|
2013-07-28 15:15:55 -04:00
|
|
|
guard :rspec, cli: File.read('.rspec').split.push('--fail-fast').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' }
|
2012-07-23 10:37:44 -04:00
|
|
|
|
2013-07-28 15:15:55 -04:00
|
|
|
# Run all specs if supporting files files are modified
|
|
|
|
watch(%r{\Aspec/(?:fixtures|lib|support|shared)/.+\.rb\z}) { 'spec' }
|
2012-07-23 10:37:44 -04:00
|
|
|
|
2013-07-28 15:15:55 -04:00
|
|
|
# Run unit specs if associated 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
|
2012-07-23 10:37:44 -04:00
|
|
|
watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
|
|
|
|
end
|
2013-07-28 15:15:55 -04:00
|
|
|
|
|
|
|
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
|