When I run guard init I get an error
app>guard init
14:56:14 - ERROR - Could not load 'guard/phpunit' or '~/.guard/templates/phpunit
' or find class Guard::Phpunit
the guard file is created but its empty. It should contain this code
guard 'phpunit', :cli => 'colors' do
watch(%r{^.+Test.php$})
end
but when I edit the file manually to include it and run guard I get
app>guard
14:59:32 - ERROR - Could not load 'guard/phpunit' or find class Guard::Phpunit
14:59:32 - ERROR - C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb
:1637:in `raise_if_conflicts'
> [#] C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `acti
vate'
> [#] C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb:212:in `rescue in try_acti
vate'
> [#] C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb:209:in `try_activate'
> [#] C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `resc
ue in require'
> [#] C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `requ
ire'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/plugin_util.rb:1
00:in `plugin_class'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/plugin_util.rb:5
7:in `initialize_plugin'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard.rb:167:in `add_p
lugin'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/dsl.rb:175:in `b
lock in guard'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/dsl.rb:173:in `e
ach'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/dsl.rb:173:in `g
uard'
> [#] C:/Users/Mark/Dropbox/www/trainercompare/app/Guardfile:4:in `_instance_eva
l_guardfile'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile/evalua
tor.rb:121:in `instance_eval'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile/evalua
tor.rb:121:in `_instance_eval_guardfile'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile/evalua
tor.rb:37:in `evaluate_guardfile'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/setuper.rb:144:i
n `evaluate_guardfile'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/setuper.rb:62:in
`setup'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/commander.rb:24:
in `start'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/cli.rb:96:in `st
art'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in
`run'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120
:in `invoke_command'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispat
ch'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `s
tart'
> [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/bin/guard:6:in `<top (requ
ired)>'
> [#] C:/Ruby193/bin/guard:23:in `load'
> [#] C:/Ruby193/bin/guard:23:in `<main>'
14:59:32 - ERROR - Invalid Guardfile, original error is:
> [#] undefined method `superclass' for nil:NilClass
C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/plugin_util.rb:57:in `
initialize_plugin': undefined method `superclass' for nil:NilClass (NoMethodErro
r)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard.rb:167:in
`add_plugin'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/dsl.rb:17
5:in `block in guard'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/dsl.rb:17
3:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/dsl.rb:17
3:in `guard'
from C:/Users/Mark/Dropbox/www/trainercompare/app/Guardfile:4:in `_insta
nce_eval_guardfile'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile
/evaluator.rb:121:in `instance_eval'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile
/evaluator.rb:121:in `_instance_eval_guardfile'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile
/evaluator.rb:37:in `evaluate_guardfile'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/setuper.r
b:144:in `evaluate_guardfile'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/setuper.r
b:62:in `setup'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/commander
.rb:24:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/cli.rb:96
:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb
:27:in `run'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation
.rb:120:in `invoke_command'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in
`dispatch'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:43
9:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/bin/guard:6:in `<to
p (required)>'
from C:/Ruby193/bin/guard:23:in `load'
from C:/Ruby193/bin/guard:23:in `<main>'
I think the problem is that guard/phpunit is an abandoned project and has not been updated to support the latest guard. I think this because when I delete all the gem files relating to guard 2.2.4 and leave only the files relating to guard 1.8.3 guard will run and watch the files and run phpunit once (fail which it shouldnt) and then refuse to continue watching so its not working completely but gets a step further.
I am not a rubyist but the code in guard/phpunit looks straightforward enough and I am wonderin
I was having this problem, and it was very painful. Currently I switched to linux, thats why I am unable to test the solution. But it should work fine.
--Notes:
to exit from guard simply press e and enter.
My guard file, borrowed from my mentor Jeffry Way's guard tool
Hope it works. Finger crossed.