【问题标题】:Reloading Guardfile on changes to files other than the Guardfile对 Guardfile 以外的文件进行更改时重新加载 Guardfile
【发布时间】:2014-04-26 01:26:02
【问题描述】:

目前,Guard::Setuper reloads just the Guardfile when it changes

我正在将一些额外的代码加载到我的保护文件中(通过require),并且我还想在其中一些必需的文件发生更改时重新加载。

我想我真的只是在寻找一个插件,但这似乎我会尝试复活guard-ego。有没有更好的方法来做到这一点?

【问题讨论】:

  • reevaluate_guardfile 是一种 DSL 方法,您应该可以在 Guardfile 匹配器中使用它。
  • 但是我会在哪个保护插件下声明该匹配器? (我是否误解了 DSL?似乎一切都需要在警卫内:某事块)
  • 嗯,我想我查看了旧版本的文档,因为我无法让它在 watch 块中工作。

标签: ruby guard


【解决方案1】:

你可以在你的 Guardfile 中尝试这样的事情(使用guard-shell):

guard :shell do
  watch(%r{path/to/your/required/files}) { Guard.evaluator.reevaluate_guardfile }
end

@Zach:最新文档位于http://guardgem.org(用法)和http://rubydoc.info/github/guard/guard/master/frames(技术)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-09
    • 1970-01-01
    • 2016-02-16
    • 2018-09-04
    • 2012-11-28
    • 1970-01-01
    • 2015-09-10
    相关资源
    最近更新 更多