2013-12-09 54 views
2

當我跑衛初始化我得到一個錯誤利用後衛的後衛/ PHPUnit的插件

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 

但是當我編輯該文件手動包括它和跑衛,我得到

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>' 

我認爲問題是,後衛/ PHPUnit的是一個廢棄的項目,也沒有已經更新以支持最新的後衛。我想,這是因爲當我刪除所有與防範2.2.4,並留下與守衛1.8.3後衛將運行,看文件,一旦運行PHPUnit的唯一文件的寶石文件(失敗,它不應該),然後拒絕繼續看着它不完全工作,但更進一步。

  1. 任何人都可以給我一個修復嗎?
  2. 我不是一個rubyist但在後衛的代碼/ PHPUnit的看起來很簡單,任何人都可以給我的地方一個鏈接,介紹瞭如何去確保一個插件是後衛2.2.4兼容嗎?我可以自己試試
  3. 其他想法?

我不是一個rubyist但在後衛的代碼/ PHPUnit的看起來很簡單,我很迷惘

回答

0

我是有這個問題,這是非常痛苦的。目前我切換到Linux,這就是爲什麼我無法測試解決方案。但它應該可以正常工作。

  • 完全去除所有紅寶石寶石和紅寶石。
  • 下載並安裝Ruby舊版本像1.9 rubyInstaller site1http://rubyinstaller.org/downloads/
  • 從該網站下載過開發工具。 Check this answer before setup, setup like this answer
  • 您需要安裝顯示消息/通知Growl Notifications for windows
  • 創業板安裝護PHPUnit的(它會自動安裝它的依賴後衛版)
  • 創業板安裝ruby_gntp
  • 運行「守衛」命令生成的網頁通過CMD app目錄,並在Windows後臺咆哮通知軟件
  • 運行所有測試按回車,第一次,當你將運行後衛測試你會得到allCompletlyImplemented()上ResultPrinter.php文件出錯,在cmd中你會得到文件位置。在該文件中

--Notes更換allCompletlyImplemented()來allCompletelyImplemented()的所有出現:

希望工程。手指交叉。

1

我認爲問題是guard/phpunit是一個被遺棄的項目,並沒有被更新以支持最新的守衛。

沒有必要爲最新的Guard版本升級Guard插件,因爲這些更改是向後兼容的。

一般來說,您需要安裝Bundler來管理您的寶石,併爲應用程序設置加載路徑以查找相關的寶石。所以如果你有在Gemfile

source 'https://rubygems.org' 
ruby '2.0.0' 

gem 'guard-phpunit' 

以下,那麼你可以安裝衛隊和衛隊:: PHPUnit的與

bundle exec guard 

另外,你看,有被釋放的guard-phpunit2active fork

+0

謝謝你,我只是簽出並安裝護phpunit2和我得到了同樣的錯誤,所以我想這排除了爲事業我將不得不看看週末如何設置一切,當我有時間嘗試尋找原因時,因爲我已經燒壞了每次保存切換到cmd行:p – Ir1sh

+0

我剛碰到這個問題早上和'guard-phpunit2'是修復。您還需要更改'Guardfile'以反映從'phpunit'到'phpunit2'的更改。像魅力一樣工作。 –

0

我有同樣的問題。 我用護phpunit2本Guardfile

guard 'phpunit2', :cli => '--colors', :tests_path => 'tests', :command => "./vendor/bin/phpunit" do 
    watch(%r{^.+Test\.php$}) 
end 

現在工作確定

+0

請格式化您的答案,使其看起來更好。 – Neeku