So there is this wiki entry on how to run guard with Rake tasks.
First, there seems to be a couple of things wrong with this entry. It seems as if the following is enough, since Guard.setup already runs Guard::Dsl.evaluate_guardfile:
task :run_all do
Guard.run_all group: :all_specs
However, I stumbled accross two issues here: First, when I have a default scope in my Guardfile (scope groups: :all_specs) I get the following error
scope groups: :all_specs
11:52:38 - ERROR - Invalid Guardfile, original error is:
> [#] undefined method `empty?' for nil:NilClass
Removing the default scope results in the following error in the runner.rb.
$ rake specs:run_all
11:54:43 - INFO - Run all_specs
undefined method `name' for :all_specs:Symbol
/Users/robin/.rvm/gems/ruby-2.0.0-p0/gems/guard-1.6.2/lib/guard/runner.rb:174:in `block (2 levels) in scoped_guards'
/Users/robin/.rvm/gems/ruby-2.0.0-p0/gems/guard-1.6.2/lib/guard/runner.rb:173:in `block in scoped_guards'
/Users/robin/.rvm/gems/ruby-2.0.0-p0/gems/guard-1.6.2/lib/guard/runner.rb:53:in `block in run'
/Users/robin/.rvm/gems/ruby-2.0.0-p0/gems/guard-1.6.2/lib/guard.rb:238:in `block in run_all'
/Users/robin/.rvm/gems/ruby-2.0.0-p0/gems/guard-1.6.2/lib/guard.rb:364:in `block in within_preserved_state'
It seems, as if the group must be provided with a Guard::Group. Using Guard.run_all group: Guard::Group.new(:all_specs) works.
Guard.run_all group: Guard::Group.new(:all_specs)
Now I propose 3 things:
Now I might have gotten this all totally wrong, so looking forward to your opinion :)
Thanks for your investigation on this! :)
About your 3 propositions: