Is there a way to create a simple guard watch? I want to run a rake task when a file changes in a specific directory and going through all of these steps is too much for this one off task. https://github.com/guard/guard/wiki/Create-a-guard
I tried adding this in the Guardfile but it doesn't work.
guard :doc do
watch(%r{^documentation}) { "rake doc:build" }
end
watch("/documentation") { "rake doc:build" }
So do you know of a simple way to run a rake task when a file is updated with guard?
The most straightforward way is to use guard-rake to run a Rake task on a file modification.
A more generic solution is to use guard-shell to run any command line tool on a file modification.
More complex use cases should be solved by creating your own guard plugin. You don't even need to create a gem, since you can simply define them as inline guard as Avdi shows us in his a Guardfile for Redis blog post.
When you want to share your Guard, just have a look at more advanced Guard plugins like guard-rspec or guard-jasmine as examples.