-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGuardfile
executable file
·74 lines (60 loc) · 2.33 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# frozen_string_literal: true
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'bundler' do
watch('Gemfile')
# Uncomment next line if Gemfile contain `gemspec" command
# watch(/^.+\.gemspec/)
end
guard 'bundler_audit', run_on_start: true do
watch('Gemfile.lock')
end
guard 'brakeman', run_on_start: true do
watch(%r{^app/.+\.(erb|haml|rhtml|rb)$})
watch(%r{^config/.+\.rb$})
watch(%r{^lib/.+\.rb$})
watch('Gemfile')
end
guard 'migrate' do
watch(%r{^db/migrate/(\d+).+\.rb})
watch('db/seeds.rb')
end
guard 'rspec', cmd: 'bundle exec rspec --colour', all_on_start: true do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch("spec/rails_helper.rb") { "spec" }
watch("spec/spec_helper.rb") { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_controller\.rb$}) do |m|
["spec/routing/#{m[1]}_routing_spec.rb",
"spec/controllers/#{m[1]}_controller_spec.rb"]
end
watch(%r{^app/controllers/api/(.+)_controller\.rb$}) do |m|
["spec/api/#{m[1]}_api_spec.rb"]
end
watch(%r{^app/serializers/(.+)_serializer\.rb$}) do |m|
["spec/controllers/api/#{m[1]}_controller_spec.rb",
"spec/api/#{m[1]}_api_spec.rb"]
end
watch('config/routes.rb') { ['spec/routing'] }
watch(%r{^config/initializers/(.+)\.rb$}) { |m| "spec/config/initilizers/#{m[1]}_spec.rb" }
watch('app/controllers/application_controller.rb') do
['spec/controllers',
'spec/api']
end
# Run mailer specs when mailer views or fixtures change
watch(%r{^app/views/notifier}) { 'spec/mailers' }
watch(%r{^spec/fixtures/notifier}) { 'spec/mailers' }
# # Capybara features specs
# watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
#
# # Turnip features and steps
# watch(%r{^spec/acceptance/(.+)\.feature$})
# watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance" }
end
guard 'process', name: 'Jest', command: 'yarn test' do
watch(%r{^app/javascript/(.+)\.([jt]sx?)$}) { |m| "spec/javascript/#{m[1]}.#{m[2]}" }
watch(%r{^spec/javascript/(.+)\.+spec.([jt]sx?)$})
end