2013-03-03 69 views
1

我無法讓Guard在jruby上工作。我通過1.9.3旁邊的rvm進行了jruby的檢查。試圖在1.9.3上運行Guard - 工作正常。如何在speclib的每次更改中自動運行規格?爲什麼Guard(rspec)在jruby上停止工作

這是我跑bundle exec guard後沒有拿到的文件在此期間

[email protected]:/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' 

回答

2

before_session鉤從Pry,但警衛不使用這種類型的鉤子(我們只使用:when_started和after_eval):

[1] guard(main)> Pry.hooks 
=> #<Pry::Hooks:0x007ff0359a36c0 
@errors=[], 
@hooks= 
    {:before_session=> 
    [[:default, 
     #<Proc:[email protected]/Users/michi/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry.rb:11>]], 
    :when_started=> 
    [[:load_guard_rc, 
     #<Proc:[email protected]/Users/michi/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/guard-1.6.2/lib/guard/interactor.rb:109>]], 
    :after_eval=> 
    [[:restore_visibility, 
     #<Proc:[email protected]/Users/michi/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/guard-1.6.2/lib/guard/interactor.rb:116>]], 
    :after_session=>[], 
    :after_read=>[], 
    :before_eval=>[]}> 

我會提交一個Pry bug,然後運行Guard而不使用交互器(guard -i),直到修復。

0

將它添加到您的Guardfile

# disable Pry for continious integration 
interactor :off 
相關問題