This repository has been archived by the owner on May 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGuardfile
48 lines (41 loc) · 1.71 KB
/
Guardfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
rspec_options = {
cmd: 'bundle exec appraisal rails52 rspec',
failed_mode: :none,
all_after_pass: false,
all_on_start: false
}
teaspoon_options = {
keep_failed: false,
all_after_pass: false,
all_on_start: false
}
guard :rspec, rspec_options do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^spec/support/(.+)\.rb$}) { |m| "spec/support_specs/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
# Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
# Specials
watch('app/controllers/application_controller.rb') { "spec/controllers" }
end
guard :teaspoon, teaspoon_options do
watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)$}) { |m| "spec/javascripts/#{m[1]}_spec.#{m[2]}" }
watch(%r{app/assets/javascripts/(.+?)\.hamlc$}) { |m| "spec/javascripts/#{m[1]}_spec.js.coffee" }
end
guard :rubocop, all_on_start: false, cli: ['-D'] do
excludes = YAML.load_file('.rubocop.yml')['AllCops']['Exclude']
watch(%r{(.+\.rb)$}) { |m| m[0] unless excludes.find { |excluded| File.fnmatch(excluded, m[0]) } }
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
# TODO: enable again after upgrading guard and guard-teaspoon to a compatible version
=begin
guard :bundler do
require 'guard/bundler'
require 'guard/bundler/verify'
helper = Guard::Bundler::Verify.new
watch(helper.real_path('Gemfile'))
end
=end