简体   繁体   English

直到提示,Guard才会对更改做出反应

[英]Guard isn’t reacting to changes until prompted

I've encountered this problem in a couple rails apps, and I haven't been able to figure out what the common thread is or find any discussion of this specific problem. 我在几个Rails应用程序中遇到了这个问题,但我一直无法弄清楚通用线程是什么,也无法找到对此特定问题的任何讨论。

Here's what happens: guard does not run specs when files are changed. 发生的情况是:更改文件后,guard不会运行规范。 BUT, if I hit enter at its prompt, causing it to run all specs, it will immediately afterwards run specs for all changed files. 但是,如果我在其提示符下按回车键,使其运行所有规范,则此后它将立即为所有更改的文件运行规范。 It seems to be detecting the changes, as it should, but not acting on them until after I make it do something. 似乎它正在检测更改,但应该在我做某件事之后才对它们进行操作。 This makes guard fairly useless to me. 这使警卫对我来说毫无用处。

The obvious answer is to try different things for monitoring file changes. 显而易见的答案是尝试不同的方法来监视文件更改。 I've read advice to try updating or downgrading the listen gem, for example. 例如,我已阅读建议以尝试更新或降级listen gem。 I've also tried running (bundle exec) guard with --force-polling and it behaves the same way. 我还尝试了使用--force-polling运行(捆绑执行)防护,其行为方式相同。 These haven't made a difference in this app. 这些并没有改变这个程序。 And here's the weird thing: I have a related rails app on the same computer, using the same versions of all the related gems, and an identical Guardfile, which works correctly! 奇怪的是:我在同一台计算机上有一个相关的Rails应用程序,使用了所有相关gem的相同版本,以及一个相同的Guardfile,它们可以正常工作! Here is that Guardfile (barely modified from some template), for reference. 是Guardfile(仅从某些模板进行了修改),以供参考。

I'm on OS X 10.8.3. 我在OS X 10.8.3上。 The apps in question are currently using Rails 3.2.6, guard 1.2.1, rspec 2.12.0, and listen 0.6.0. 有问题的应用程序当前正在使用Rails 3.2.6,guard 1.2.1,rspec 2.12.0和侦听0.6.0。

Is there a specific reason for using outdated versions of both Guard and Listen? 是否有使用过时的Guard和Listen版本的特定原因?

I have a related rails app on the same computer, using the same versions of all the related gems, and an identical Guardfile, which works correctly! 我在同一台计算机上有一个相关的Rails应用程序,使用了所有相关gem的相同版本,以及一个相同的Guardfile,它可以正常工作!

Do those apps use different Ruby version? 这些应用程序使用其他Ruby版本吗? If one is on Ruby 1.8.7, did you add proper readline support ? 如果其中一个在Ruby 1.8.7上,您是否添加了适当的readline支持

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM