Rspec 在Windows上将guard与JRuby一起使用失败

Rspec 在Windows上将guard与JRuby一起使用失败,rspec,jruby,guard,Rspec,Jruby,Guard,我正在尝试使用JRuby在Windows上设置Guard,并获得以下输出: $ guard You must 'gem install win32console' to use color on Windows WARNING: You are using Guard outside of Bundler, this is dangerous and could not work. Using `bundle exec guard` is safer. Guard uses Notifu to

我正在尝试使用JRuby在Windows上设置Guard,并获得以下输出:

$ guard
You must 'gem install win32console' to use color on Windows
WARNING: You are using Guard outside of Bundler, this is dangerous and could not
 work. Using `bundle exec guard` is safer.
Guard uses Notifu to send notifications.
Guard is now watching at 'C:/Workspace/OE_11/CyberTrack_Rails3'
Guard::RSpec is running, with RSpec 2!

Running all specs
bundler: command not found: rspec
Install missing gem executables with `bundle install`
>
如果我只键入命令'rspec',事情就会正常。那么我在这里错过了什么

$ rspec
←[32m.←[0m←[32m.←[0m←[32m.←[0m←[32m.←[0m←[32m.←[0m←[32m.←[0m←[32m.←[0m←[32m.←[0m


Finished in 1.39 seconds
←[32m8 examples, 0 failures←[0m
我将rspec.bat的路径添加到path环境变量中

顺便说一下,我在用Windows。在Ubuntu上,我很快就能让一切正常运行

更新 档案:


我认为这是一个
bundler
错误,因为如果我运行:

bundle exec rspec spec
我设法在
guard rspec
源文件中添加注释和一些代码

打开文件:

C:\jruby-1.6.7\lib\ruby\gems\1.8\gems\guard-rspec-0.6.0\lib\guard\rspec\runner.rb
Obs:请注意,此路径在您的计算机上可能不同。无论如何,只要转到
guard rspec
gem的源代码并打开
runner.rb
文件即可

并将
rspec_命令
更改为:

  def rspec_command(paths, options={})
    warn_deprectation(options)

    cmd_parts = []
    cmd_parts << "rvm #{options[:rvm].join(',')} exec" if options[:rvm].is_a?(Array)
    cmd_parts << "bundle exec" if (bundler? && options[:binstubs] == true && options[:bundler] != false) || (bundler? && options[:bundler] != false)
    cmd_parts << "'"
    cmd_parts << rspec_exec(options)
    cmd_parts << options[:cli] if options[:cli]
    cmd_parts << "-f progress" if options[:cli].nil? || !options[:cli].split(/[\s=]/).any? { |w| %w[-f --format].include?(w) }
    #cmd_parts << "-r #{File.dirname(__FILE__)}/formatters/notification_#{rspec_class.downcase}.rb -f Guard::RSpec::Formatter::Notification#{rspec_class}#{rspec_version == 1 ? ":" : " --out "}/dev/null" if options[:notification] != false
    cmd_parts << "--failure-exit-code #{failure_exit_code}" if failure_exit_code_supported?(options)

    cmd_parts << paths.join(' ')
    cmd_parts << "'"

    cmd_parts.join(' ')
  end
它在这里工作,所以它也应该在你的机器上工作。
我在bundler上为该问题打开了一个问题。

仍然收到相同的错误。。。但是,我追踪到cmd_部分,它显示:bundle exec rspec-f progress——失败退出代码2 spec spec‘现在,如果我运行bundle exec rspec spec,我会得到错误:bundler:command not found:rspec。。。也许这是另一个原因?rspec规范工作正常,bundle exec rspec规范不工作。(在Windows上)。查看github,事实上,bundle exec“rspec spec”工作正常。奇怪。然而,Guard仍然不起作用,但我只是看到我忘了添加一行…Thx,现在可以正常工作了,同时我学会了如何调试gems。顺便说一句,bundle exec spork的问题与bootstrap完全相同。bundle exec“spork--bootstrap”工作正常。我所做的就是运行make guard rspec,并使用引号运行代码。你对我的代码做了任何修改,使它在你的机器上工作了吗?如果是这样,请将其张贴在此处,以便帮助他人。=]
  def rspec_command(paths, options={})
    warn_deprectation(options)

    cmd_parts = []
    cmd_parts << "rvm #{options[:rvm].join(',')} exec" if options[:rvm].is_a?(Array)
    cmd_parts << "bundle exec" if (bundler? && options[:binstubs] == true && options[:bundler] != false) || (bundler? && options[:bundler] != false)
    cmd_parts << "'"
    cmd_parts << rspec_exec(options)
    cmd_parts << options[:cli] if options[:cli]
    cmd_parts << "-f progress" if options[:cli].nil? || !options[:cli].split(/[\s=]/).any? { |w| %w[-f --format].include?(w) }
    #cmd_parts << "-r #{File.dirname(__FILE__)}/formatters/notification_#{rspec_class.downcase}.rb -f Guard::RSpec::Formatter::Notification#{rspec_class}#{rspec_version == 1 ? ":" : " --out "}/dev/null" if options[:notification] != false
    cmd_parts << "--failure-exit-code #{failure_exit_code}" if failure_exit_code_supported?(options)

    cmd_parts << paths.join(' ')
    cmd_parts << "'"

    cmd_parts.join(' ')
  end
 1. commented on of the lines
 2. Added 2 code line to add "quotes" to the string builder.