Friday, July 12, 2013

Making Rubymine Play Well With Others

I use RubyMine, but my colleagues don't. This can cause lots of problems when RubyMine needs specific gems for debugger integration:


    gem 'ruby-debug-base19x'
    gem 'ruby-debug-ide'


Crucially, it's incompatible with the debugger gem, which everybody else needsHere's how I got it working:


1) Don't require the 'debugger' gem if rubymine is present:

In your gemfile:
# rubymine needs some specific gemfiles that conflict with debugger. Rubymine puts an .idea folder
# in the git root, so that's how we detect its presence
is_rubymine_present = Pathname.new("#{File.absolute_path(File.dirname(__FILE__))}/.idea").exist?
# include the debugger gem, but don't require it if rubymine is present. This will load the gem,
# so we don't get Gemfile.lock changes, but it won't be require'd and rubymine will function.
gem 'debugger', (is_rubymine_present ? { :require => false } : {})




2) Let RubyMine install debug gems it needs outside bundler
If you try to debug your server (Run -> Debug...), RubyMine will prompt you to install some gems. Click Ok.  This installs the gems via gem install, which doesn't modify your Gemfile and screw up your teammates bundles.



3) Don't put ruby-debug-ide, ruby-debug-base19x, or any other gem that rubymine needs into your Gemfile.
If you do, you'll break debugging for everyone who doesn't use rubymine.





This reminds me why I often get frustrated with Configuration Driven Development: You're not building stuff, you're just googling around and twisting arcane nobs on someone else's work until your rube-goldberg machine finally works.