在对 Guardfile 以外的文件进行更改时重新加载 Guardfile [英] Reloading Guardfile on changes to files other than the Guardfile

查看:44
本文介绍了在对 Guardfile 以外的文件进行更改时重新加载 Guardfile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,Guard::Setuper 仅在 Guardfile 发生变化时重新加载它.

Currently, Guard::Setuper reloads just the Guardfile when it changes.

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

I'm loading some additional code into my guard file (via require), and I'd like to also reload when some of those required files change.

我想我真的只是在寻找一个插件,但似乎我会尝试复活 守卫自我.有没有更好的方法来实现这一点?

I guess I'm really just looking for a plugin, but that seems like I'd be trying resurrect guard-ego. Is there a better way of accomplishing this?

推荐答案

你可能可以在你的 Guardfile 中尝试这样的事情(使用 防护壳):

You could probably try something like this in your Guardfile (using 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(技术).

@Zach: Up-to-date documentation is at http://guardgem.org (usage) and http://rubydoc.info/github/guard/guard/master/frames (technical).

这篇关于在对 Guardfile 以外的文件进行更改时重新加载 Guardfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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