3

我和这里的这位先生有类似的问题。

我一直在尝试通过 rake 任务运行黄瓜功能。而且我一直在标题中找到指定的错误。

这是一个完整的回溯。还有我的红宝石版本。(当我尝试运行 rails version 命令时,我得到“找不到命令”。

$ rake features:all --trace
** Invoke features:all (first_time)
** Invoke features:watir_webdriver (first_time)
** Execute features:watir_webdriver
c:/Ruby193/bin/ruby -S bundle exec cucumber  --profile watir
Using the watir profile...
No such file or directory - /dev/null (Errno::ENOENT)
c:/Ruby193/lib/ruby/1.9.1/webrick/log.rb:34:in `initialize'
c:/Ruby193/lib/ruby/1.9.1/webrick/log.rb:34:in `open'
c:/Ruby193/lib/ruby/1.9.1/webrick/log.rb:34:in `initialize'
c:/Ruby193/lib/ruby/1.9.1/webrick/log.rb:124:in `initialize'
c:/code/page-object/features/sample-app/sample_app.rb:12:in `new'
c:/code/page-object/features/sample-app/sample_app.rb:12:in `start'
c:/code/page-object/features/support/ajax_text_environment.rb:6:in `block in run'
rake aborted!
Command failed with status (1): [c:/Ruby193/bin/ruby -S bundle exec cucumbe...]
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.9/lib/cucumber/rake/task.rb:104:in `run'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.9/lib/cucumber/rake/task.rb:193:in `block in define_task'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
c:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
c:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
c:/Ruby193/bin/rake:19:in `load'
c:/Ruby193/bin/rake:19:in `<main>'
Tasks: TOP => features:all => features:watir_webdriver

和红宝石版本

 ruby -v
 ruby 1.9.3p0 (2011-10-30) [i386-mingw32]

任何帮助将不胜感激。谢谢。

4

3 回答 3

9

dev/null里面,config/initializers/quiet_assetsdev/nulllogger.txt

于 2012-10-02T05:52:19.070 回答
1

如果您在 *nix 和 windows 上使用相同的应用程序,您可以替换'/dev/null'

RUBY_PLATFORM != 'i386-mingw32' ? '/dev/null' : 'NUL'

对我来说,它在 quiet_assets.rb 中,我替换了

Rails.application.assets.logger = Logger.new('/dev/null')

Rails.application.assets.logger = Logger.new(RUBY_PLATFORM != 'i386-mingw32' ? '/dev/null' : 'NUL')

于 2013-07-12T08:17:45.790 回答
0

我真的想通了。我正在处理的应用程序中有一个配置设置位于一个稍微模糊的文件中。它将记录器的路径设置为“/dev/null”。我只是将其更改为“logger.txt”,现在可以使用。

于 2012-03-23T12:14:49.390 回答