Created
February 21, 2020 18:06
-
-
Save RobinDaugherty/ad5862d12c6eae587c321dd89bde827d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# notification :terminal_notifier | |
ignore %r{^(tmp|log|run|bin)/} | |
# guard 'migrate', test_prepare: true do | |
# watch(%r{^db/migrate/(\d+).+\.rb}) | |
# watch('db/seeds.rb') | |
# end | |
# Runs rubocop only after the tests have passed. | |
# https://github.com/yujinakayama/guard-rubocop#advanced-tips | |
group :red_green_refactor, halt_on_fail: true do | |
test_options = { | |
spring: 'bin/rails test', | |
failed_mode: :keep, | |
all_on_start: false, | |
} | |
guard :minitest, test_options do | |
watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" } | |
watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' } | |
watch(%r{^app/controllers/(.+)_controller\.rb$}) do |m| | |
"test/integration/#{m[1]}_test.rb" | |
end | |
watch(%r{^app/views/(.+)_mailer/.+}) do |m| | |
"test/mailers/#{m[1]}_mailer_test.rb" | |
end | |
watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" } | |
watch(%r{^test/.+_test\.rb$}) | |
watch(%r{^test/test_helper\.rb$}) { 'test' } | |
end | |
rubocop_options = { | |
cli: %w[-D --format fuubar], | |
all_on_start: false, | |
keep_failed: false, | |
} | |
guard :rubocop, rubocop_options do | |
watch('Guardfile') | |
watch('config.ru') | |
watch('Rakefile') | |
watch(%r{.+\.rb$}) | |
watch(%r{.+\.rake$}) | |
# Rerun rubocop on everything in the folder or below a .rubocop.yml file | |
watch(%r{(?:.+/)?rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment