I am using:
Yesterday I installed guard, with the plugins livereload and <
After googling and trying everything I found, nothing seemed to work. So, I cool down my horses, and decided to play with guard.
Problem found and solved.
PROBLEM: guard do not react (it is watching) on file changes
THE CAUSE: the regex that are used in Guardfile, seem to be incompatible with rails 5.1.5 file paths
SOLUTION:
guard :minitest do
watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
watch(%r{^test/.+_test\.rb$})
watch(%r{^test/test_helper\.rb$}) { 'test' }
watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/controllers/#{m[1]}_test.rb" }
watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" }
watch(%r{^app/mailers/(.*)\.rb$}) { |m| "test/mailers/#{m[1]}_test.rb" }
watch(%r{^app/models/(.*)\.rb$}) { |m| "test/models/#{m[1]}_test.rb" }
watch(%r{^app/veiws/(.*)\.rb$}) { |m| "test/system/#{m[1]}_test.rb" }
end
I hope this could be useful to you.
I just fine tuned the regex. Here they come:
guard :minitest do
watch(%r{test\/.+\.rb})
watch(%r{app\/controllers\/(.*)\.rb}) { |m| "test/controllers/#{m[1]}_test.rb" }
watch(%r{app\/controllers\/(.*)\.rb}) { |m| "test/integration/#{m[1]}_test.rb" }
watch(%r{app\/helpers\/(.*)\.rb}) { |m| "test/helpers/#{m[1]}_test.rb" }
watch(%r{app\/models\/(.*)\.rb}) { |m| "test/models/#{m[1]}_test.rb" }
watch(%r{app\/mailers\/(.*)\.rb}) { |m| "test/mailers/#{m[1]}_test.rb" }
watch(%r{app\/views\/(.*)\/.*\.html\.haml}) { |m| "test/system/#{m[1]}_test.rb" }
watch(%r{app\/views\/(.*)\/.*\.coffee}) { |m| "test/system/#{m[1]}_test.rb" }
end