Simple ruby ​​guard

Is there a way to create a simple watchdog chat? I want to start a rake task when a file changes in a specific directory and goes through all these steps, too much for this one task. https://github.com/guard/guard/wiki/Create-a-guard

I tried adding this to the Guardfile, but it does not work.

guard :doc do watch(%r{^documentation}) { "rake doc:build" } end watch("/documentation") { "rake doc:build" } 

Did you know that an easy way to run the rake command when updating a file with guard ?

+6
source share
1 answer

The easiest way is to use guard-rake to run the Rake task when the file changes.

A more general solution is to use guard-shell to run any command line tool when changing a file.

More complex use cases should be resolved by creating your own security plugin . You don’t even need to create a gem, as you can simply define them as a built-in guard, as Avdi shows us on his Guardfile for Redis blog.

If you want to share your guard, just take a look at the more advanced Guard plugins such as guard-rspec or guard-jasmine as examples.

+7
source

Source: https://habr.com/ru/post/919283/


All Articles