将guard与guard/phpunit插件一起使用

将guard与guard/phpunit插件一起使用,phpunit,laravel-4,guard,Phpunit,Laravel 4,Guard,当我运行guard init时,我得到一个错误 app>guard init 14:56:14 - ERROR - Could not load 'guard/phpunit' or '~/.guard/templates/phpunit ' or find class Guard::Phpunit 已创建保护文件,但其为空。它应该包含这个代码 guard 'phpunit', :cli => 'colors' do watch(%r{^.+Test.php$}) end 但当我

当我运行guard init时,我得到一个错误

app>guard init
14:56:14 - ERROR - Could not load 'guard/phpunit' or '~/.guard/templates/phpunit
' or find class Guard::Phpunit
已创建保护文件,但其为空。它应该包含这个代码

guard 'phpunit', :cli => 'colors' do
watch(%r{^.+Test.php$})
end
但当我手动编辑文件以包含它并运行guard时,我得到

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>'
app>guard
14:59:32-错误-无法加载“guard/phpunit”或找到类guard::phpunit
14:59:32-错误-C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb
:1637:在“冲突时提出”
>[C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in`acti
瓦特
>[C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb:212:in'rescue in try_acti
瓦特
>[#]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'
>[#]C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in`requ
愤怒的
>[#]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:在“初始化插件”中
>C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard.rb:167:in'add\p
卢金
>C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/dsl.rb:175:in`b
锁上门卫
>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
卫兵
>[#]C:/Users/Mark/Dropbox/www/trainercompare/app/Guardfile:4:in``实例` eva
l_guardfile'
>[#]C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile/evalua
tor.rb:121:在“实例评估”中
>[#]C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile/evalua
tor.rb:121:在“实例评估”中
>[#]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‘评估_guardfile’
>[#]C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/setuper.rb:62:in
`设置'
>[#]C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/commander.rb:24:
在“开始”中
>C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/cli.rb:96:in`st
艺术的
>C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in
`跑
>[#]C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120
:在“调用命令”中
>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
酸的
>[#]C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/bin/guard:6:in`'
>[#]C:/Ruby193/bin/guard:23:in'load'
>[C:/Ruby193/bin/guard:23:in`'
14:59:32-错误-Guardfile无效,原始错误为:
>[#]nil:NilClass的未定义方法“超类”
C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/plugin_util.rb:57:in`
初始化插件:nil:NilClass(NoMethodErro)的未定义方法“超类”
(r)
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard.rb:167:in
`添加插件'
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/dsl.rb:17
5:在“挡在守卫中”
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/dsl.rb:17
3:在“每个”中
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/dsl.rb:17
3:在“guard”中
来自C:/Users/Mark/Dropbox/www/trainercompare/app/Guardfile:4:in`\u insta
安全评估文件'
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile
/evaluator.rb:121:在“实例评估”中
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile
/evaluator.rb:121:在“\u instance\u eval\u guardfile”中
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/guardfile
/evaluator.rb:37:in'evaluate_guardfile'
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/setuper.r
b:144:在“评估担保文件”中
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/lib/guard/setuper.r
b:62:在“设置”中
来自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
:在“开始”中
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb
:27:在“run”中
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation
.rb:120:在“调用命令”中
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in
`派遣'
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:43
9:在“开始”中
来自C:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.2.4/bin/guard:6:in`'
来自C:/Ruby193/料仓/护罩:23:在“装载”中
来自C:/Ruby193/bin/guard:23:in`'
我认为问题在于guard/phpunit是一个废弃的项目,尚未更新以支持最新的guard。我认为这是因为当我删除与guard 2.2.4相关的所有gem文件并只保留与guard 1.8.3相关的文件时,guard将运行并监视这些文件,并运行phpunit一次(失败,它不应该),然后拒绝继续监视,因此它不能完全工作,但会更进一步

  • 有人能给我一个解决办法吗
  • 我不是rubyist,但是guard/phpunit中的代码看起来很简单,谁能给我一个链接,说明如何确保插件与guard 2.2.4兼容?然后我可以自己试试
  • 还有其他想法吗

  • 我不是一个红宝石专家,但是guard/phpunit中的代码看起来很简单,我想知道我遇到了这个问题,这非常痛苦。目前我切换到linux,这就是为什么我无法测试解决方案的原因。但它应该可以正常工作

    • 删除所有红宝石和红宝石完全
    • 下载并安装ruby旧版本,如1.9:
    • 从该站点下载开发工具
      source 'https://rubygems.org'
      ruby '2.0.0'
      
      gem 'guard-phpunit'
      
      bundle exec guard
      
      guard 'phpunit2', :cli => '--colors', :tests_path => 'tests', :command => "./vendor/bin/phpunit" do
        watch(%r{^.+Test\.php$})
      end