I've been using Guardfiles for a while, mostly as an asset pipeline. For instance, I'll have a Guardfile with a group assets
.
In my process, I will run do this:
$> guard
guard> assets
# Guard does stuff here
guard> exit
I do this very often. What I would like is a way of doing this in non-interactive mode. For instance, something like this:
$> guard --run_all assets
# Guard does stuff here
$> # Guard exited once the task was finished
Considering the amount of research I've put into this, I'm assuming this isn't possible. But maybe someone has a solution ?
Otherwise I'll just write my own gem to read a Guardfile and run the run_all
method on Guard plugins, without using Guard itself. I'm afraid that might not work well with all Guard plugins though.
EDIT: This was solved thanks to Dany's link to Guard's wiki. Unfortunately, the documentation doesn't seem to be up to date, but it's still possible to run the guards using something such as this:
require 'guard'
Guard.setup
Guard.guards.each {|guard| guard.run_all}
You could also pipe your group name to guard
. So if you wanted to run the group assets
, you could do:
$ echo assets | guard
[1] guard(main)> assets
[2] guard(main)>
16:13:36 - INFO - Bye bye...
$
or
$ guard <<< assets