RubyMine/IDEA ruby debugger cannot load linecache gem in bundler mode
bundler, ruby, ruby-on-rails, rubygems, rubymine
Solution
I found the solution / work around: just add
require 'rubygems'
to the first line of ruby-debug-base.rb (making sure adding to the right one used by RM/Idea as there can be multiple versions.)
but I still don't know why it would just work without the bundler option. I feel the opposite should be the case.
Problem
Start debugger within bundler (check the "Run the script in bundle context" option in the run target's bundler tab) in IDEA 13 (and earlier version e.g. 11) Ruby, I always get ``` /Users/me/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/me/.rvm/gems/ree-1.8.7-2012.02/gems/ruby-debug-ide-0.4.22/bin/rdebug-ide --disable-int-handler --port 58100 --dispatcher-port 58101 -- /Users/me/railproj/script/spec --format specdoc spec/**/any_ruby_spec.rb /Users/me/.rvm/gems/ree-1.8.7-2012.02/gems/ruby-debug-base-0.10.5.rc9/lib/ruby-debug-base.rb:3:in `require': no such file to load -- linecache (LoadError) from /Users/me/.rvm/gems/ree-1.8.7-2012.02/gems/ruby-debug-base-0.10.5.rc9/lib/ruby-debug-base.rb:3 from /Users/me/Library/Application Support/IntelliJIdea13/ruby/rb/gems/debug_preloader.rb:2:in `require' from /Users/me/Library/Application Support/IntelliJIdea13/ruby/rb/gems/debug_preloader.rb:2 ``` The linecache gem is installed properly ``` $ gem which linecache /Users/me/.rvm/gems/ree-1.8.7-2012.02/gems/linecache-0.46/lib/linecache.rb ``` Putting the linecache in Gemfile does not help at all. But launch debugger for the same run target without bundler (unchecking "Run the script in bundle context") works. Of course, one would get gem conflict easily with bundler context. How can this be fixed?