【发布时间】:2013-03-03 21:22:50
【问题描述】:
我无法让 Guard 在 jruby 上工作。我已经通过 rvm 在 1.9.3 旁边安装了 jruby。尝试在 1.9.3 上运行 Guard - 工作正常。如何使其在 spec 或 lib 的每次更改时自动运行规范?
这是我在运行 bundle exec guard 后得到的,同时没有文件更改
vagrant@precise64:/vagrant/sample$ bundle exec guard
21:16:46 - INFO - Guard uses TerminalTitle to send notifications.
21:16:47 - INFO - Guard::RSpec is running
21:16:47 - INFO - Running all specs
...
Finished in 0.025 seconds
3 examples, 0 failures
21:17:20 - INFO - Guard is now watching at '/vagrant/sample'
before_session hook failed: Errno::ENOENT: No such file or directory - /vagrant/sample
org/jruby/RubyFile.java:333:in `initialize'
(see _pry_.hooks.errors to debug)
[1] guard(main)>
再次运行规范的唯一方法是在此处按 ENTER。我也无法确定这个No such file or directory 的来源(它不会在 1.9.3 MRI 上弹出)。我不熟悉守卫的内部结构,也无法真正找到发生这种情况的原因。
我的Guardfile 是标准的:
guard 'rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end
而Gemfile 仅包含:
gem 'rspec', '~>2.13.0'
gem 'guard-rspec'
gem 'rb-inotify', '~>0.9'
【问题讨论】:
标签: ruby rspec jruby guard specifications