My goal is to create a simple custom defender with Guard . Installing gem and installing the package for my application has stopped. My Guard file contains:
notification :growl
guard 'eyeball' do
watch %r{^app/(.*)}
watch %r{^config/(.*)}
watch %r{^lib/(.*)}
end
Okay, then I need to tell the Guard what to do when the match takes place. But I don’t know where to do it. (In this case, I want to see my application for changes and run some arbitrary code. Suppose there is no defender available for what I want . Learn how to do it yourself.)
In true "error and see what errors appear next", when I run guard, I get this error message:
ERROR: Could not load 'guard / eyeball' or find class Guard :: Eyeball
ERROR: cannot load such file - guard / eyeball
ERROR: Invalid Guardfile, original error is:
undefined method `new 'for nil: NilClass
ERROR: No guards found in Guardfile, please add at least one.
Guard uses Growl to send notifications.
Guard is now watching at '/ Users / my-user-name / dev / my-project-name'
So this gives me a hint that I need to create a file guard/eyeball.rb. May be? But how was I supposed to know this from the documentation?
I read (a few times) the very detailed and useful Guard README , but I did not find a good simple example showing how someone is doing “just the basics” of writing my own guard. Unexpectedly, RailsCasts also did not answer my question: see RailsCast # 264 Guard .
- Guard README? ? !