vim-ruby-debugger icon indicating copy to clipboard operation
vim-ruby-debugger copied to clipboard

Debugger doesn't work with Bundler

Open petRUShka opened this issue 14 years ago • 8 comments

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

petRUShka avatar Aug 19 '11 12:08 petRUShka

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

astashov avatar Aug 19 '11 12:08 astashov

Have you plans about fixing this issue?

petRUShka avatar Aug 19 '11 12:08 petRUShka

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

astashov avatar Aug 19 '11 12:08 astashov

Doesn't Rspec 2 require the debug flag?

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

jweir avatar Aug 19 '11 13:08 jweir

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

astashov avatar Aug 19 '11 14:08 astashov

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

astashov avatar Aug 19 '11 14:08 astashov

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.

astashov avatar Aug 20 '11 02:08 astashov

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

petRUShka avatar Aug 21 '11 19:08 petRUShka