我正在laravel 4中创建一个应用程序/站点。我正在使用laravel-guard设置Laravel,它可以帮助您轻松构建资产并创建模块化设置,以便您可以快速缩小css和js。
我按预期运行了所有内容here
我已经运行了正确的ruby版本等,这样很酷。
当我运行命令php artisan guard:make
时,它完全正常,但是当我尝试运行
php artisan guard:watch
我在那里得到了一些非常奇怪的错误,但它们根本不能正常工作。
我得到的错误是:
17:21:54 - ERROR - Could not load 'guard/phpunit' or find class Guard::Phpunit
17:21:54 - ERROR - /Users/mdunbavan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts'
> [#] /Users/mdunbavan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `activate'
> [#] /Users/mdunbavan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems.rb:212:in `rescue in try_activate'
> [#] /Users/mdunbavan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems.rb:209:in `try_activate'
> [#] /Users/mdunbavan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
> [#] /Users/mdunbavan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard/plugin_util.rb:100:in `plugin_class'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard/plugin_util.rb:57:in `initialize_plugin'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard.rb:167:in `add_plugin'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard/dsl.rb:166:in `guard'
> [#] /Freelance/Current Projects/knight-dragon/knightdragon/Guardfile:12:in `_instance_eval_guardfile'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard/guardfile/evaluator.rb:121:in `instance_eval'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard/guardfile/evaluator.rb:121:in `_instance_eval_guardfile'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard/guardfile/evaluator.rb:37:in `evaluate_guardfile'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard/setuper.rb:144:in `evaluate_guardfile'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard/setuper.rb:62:in `setup'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard/commander.rb:24:in `start'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/lib/guard/cli.rb:96:in `start'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/gems/guard-2.2.1/bin/guard:6:in `<top (required)>'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/bin/guard:19:in `load'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/bin/guard:19:in `<main>'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/bin/ruby_noexec_wrapper:14:in `eval'
> [#] /Users/mdunbavan/.rvm/gems/ruby-1.9.3-p286/bin/ruby_noexec_wrapper:14:in `<main>'
17:21:54 - ERROR - Invalid Guardfile, original error is:
> [#] undefined method `superclass' for nil:NilClass
这是我的宝石列表中的内容:
guard (2.2.1, 1.4.0)
guard-coffeescript (1.3.4)
guard-concat (0.0.3)
guard-livereload (2.0.0)
guard-phpunit (0.1.4)
guard-sass (1.3.2)
我查看了我的宝石列表,它似乎就在那里,所以我根本无法解决它。
有谁知道为什么会这样?
答案 0 :(得分:3)
与Guard :: PHPUnit有关的问题,我也无法使其正常工作。如果您不需要PHPUnit,则需要解决方法:编辑Guardfile并对此块进行注释:
#guard :phpunit, :all_on_start => false, :tests_path => 'app/tests/', :cli => '--colors -c phpunit.xml', :require => false do
# # Run any test in app/tests upon save.
# watch(%r{^.+Test\.php$})
#
# # When a view file is updated, run tests.
# # Tip: you probably only want to run your integration tests.
# watch(%r{app/views/.+\.php}) { Dir.glob('app/tests/**/*.php') }
#
# # When a file is edited, try to run its associated test.
# # Save app/models/User.php, and it will run app/tests/models/UserTest.php
# watch(%r{^app/(.+)/(.+)\.php$}) { |m| "app/tests/#{m[1]}/#{m[2]}Test.php"}
#end
现在它应该可以工作,但PHPUnit将被禁用:
php artisan guard:watch
答案 1 :(得分:0)
sudo gem install guard-phpunit2
编辑:phpunit - &gt; phpunit2
guard :phpunit2, :all_on_start => false, :tests_path => 'app/tests/', :cli => '--colors -c phpunit.xml' do
# Run any test in app/tests upon save.
watch(%r{^.+Test\.php$})
# When a view file is updated, run tests.
# Tip: you probably only want to run your integration tests.
watch(%r{app/views/.+\.php}) { Dir.glob('app/tests/**/*.php') }
# When a file is edited, try to run its associated test.
# Save app/models/User.php, and it will run app/tests/models/UserTest.php
watch(%r{^app/(.+)/(.+)\.php$}) { |m| "app/tests/#{m[1]}/#{m[2]}Test.php"}
end