netzpirat / guard-rspectacle

Experimental embedded RSpec runner.
MIT License
37 stars 5 forks source link

work around missing CWD in load_path on 1.9 #1

Closed effkay closed 12 years ago

effkay commented 12 years ago

When using guard-rspectacle on MRI 1.9.3 I get the following Error, which I think is because the current working directory is not in load path anymore on 1.9:

Guard is now watching at '/Users/felipe/src/effkay/blazing'
Starting RSpectacle test environment
ERROR: Guard::RSpectacle failed to achieve its <start>, exception was:
LoadError: no such file to load -- spec/spec_helper
/Users/felipe/src/effkay/guard-rspectacle/lib/guard/rspectacle.rb:41:in `require'
/Users/felipe/src/effkay/guard-rspectacle/lib/guard/rspectacle.rb:41:in `start'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:276:in `block in run_supervised_task'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:274:in `catch'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:274:in `run_supervised_task'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:207:in `block (3 levels) in run_guard_task'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:203:in `each'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:203:in `block (2 levels) in run_guard_task'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:202:in `catch'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:202:in `block in run_guard_task'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:201:in `each'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:201:in `run_guard_task'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard.rb:119:in `start'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/lib/guard/cli.rb:61:in `start'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/gems/guard-0.8.4/bin/guard:6:in `<top (required)>'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/bin/guard:19:in `load'
/Users/felipe/.rvm/gems/ruby-1.9.2-p290@blazing-rework/bin/guard:19:in `<main>'

The quick workaround I pushed just uses the relative path. I am sure there might be cleaner ways of handling this, but on the other hand, guard itself seems to assume that it is started from the project root itself.

(e.g, we could also add the cwd to the load path before requiring spec_helper or so if you prefer?)