astashov / vim-ruby-debugger

Vim plugin for debugging Ruby applications (using ruby-debug-ide gem)
435 stars 36 forks source link

Debugger doesn't work with Bundler #56

Open petRUShka opened 13 years ago

petRUShka commented 13 years ago

I opened _spec.rb file in VIM and then called :RdbTest. I got such output:

Fast Debugger (ruby-debug-ide 0.4.16, ruby-debug-base 0.10.4) listens on 127.0.0.1:39767
        /home/petrushka/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems.rb:341:in `bin_path'
        /usr/bin/spec:19
        /home/petrushka/.rvm/gems/ruby-1.8.7-p334/gems/ruby-debug-ide-0.4.16/lib/ruby-debug-ide.rb:112:in `debug_load'
        /home/petrushka/.rvm/gems/ruby-1.8.7-p334/gems/ruby-debug-ide-0.4.16/lib/ruby-debug-ide.rb:112:in `debug_program'
        /home/petrushka/.rvm/gems/ruby-1.8.7-p334/gems/ruby-debug-ide-0.4.16/bin/rdebug-ide:87
        /home/petrushka/.rvm/gems/ruby-1.8.7-p334/bin/rdebug-ide:19:in `load'
        /home/petrushka/.rvm/gems/ruby-1.8.7-p334/bin/rdebug-ide:19
Uncaught exception: can't find gem rspec-core (>= 0) with executable spec

ok. I tried to call Rdebugger 'bundle exec rspec spec/models/user_spec.rb'. It run ok, but didn't stop on breakpoints in user_spec.rb and user.rb. I have full rspec output in :RdbLog

astashov commented 13 years ago

Yup, this is a problem - by some reason the debugger doesn't work with Bundler. I can repeat that.

petRUShka commented 13 years ago

Have you plans about fixing this issue?

astashov commented 13 years ago

For sure, when I have some free time. :)

jweir commented 13 years ago

Doesn't Rspec 2 require the debug flag?

'bundle exec rspec spec/models/user_spec.rb --debugger'

astashov commented 13 years ago

Hmm, I don't know, but RSpec 2 works just perfectly if it is called without 'bundle exec'.

astashov commented 13 years ago

I hope I'll have a chance to take a look at the issue during this weekend.

astashov commented 13 years ago

The problem with 'bundle exec' - it uses Kernel.exec run running the ruby script. I.e.

bundle exec rspec spec/models/user_spec.rb

will actually run

Kernel.exec(["rspec", "spec/models/user_spec.rb"])

Kernel.exec replaces the current process by running the rspec command, so it is not in the debugger's scope anymore. So, for now I even don't know how to make vim-ruby-debugger work with 'bundle exec'...

As a workaround, you can run rspec directly from vendor/bundle (I guess you store gems there, right?). I.e.:

:let g:ruby_debugger_spec_path='vendor/bundle/ruby/1.9.1/gems/rspec-core-2.6.4/bin/rspec'
:RdbTest

Hope that will help.

petRUShka commented 13 years ago

Thanks! I will try this. But because of bundle influence on Rails world it will be a trouble :(