保护 gem 不监视文件更改 [英] guard gem do not watch file changes

查看:50
本文介绍了保护 gem 不监视文件更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用:

  • 导轨 5.1.5
  • 守卫 2.14.2
  • linuxmint

昨天我用插件livereloadminitest安装了guard.

Yesterday I installed guard, with the plugins livereload and minitest.

我使用 guard 来自动化我的测试并确保没有任何错误被破坏.

I use guard to automate my tests and make sure nothing gets broken by mistake.

我发现由于某种原因,guard 没有对文件更改做出反应.当它第一次启动时,它运行了所有测试,给了我一个提示,我必须在提示中按 Enter,然后,它开始执行所有测试 再次,每轮大约需要 1 小时.

I found out that for some reason, guard was not reacting to file changes. When it was first launched, it runned all tests, give me a prompt, and I had to press Enter in the prompt, and then, it start doing ALL THE TESTS again, each round takes about 1hr.

推荐答案

我只是微调了正则表达式.他们来了:

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

这篇关于保护 gem 不监视文件更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆