Thursday, April 26, 2012

Conditionally load ruby-debug gem

At the time of this post ruby-debug isn't available on rubygems.org for 1.9.3. I can't code ruby without it, well I can but I wont. If not everyone on the team wants to do this ruby-debug-on-ruby-193 to get it working you can conditionally load the gem like so:
# for all you ruby-debug haters out there
begin
  if (Gem::Specification::find_by_name "ruby-debug-base19", ">= 0.11.26")
    gem 'linecache19',       '>= 0.5.13'
    gem 'ruby-debug-base19', '>= 0.11.26'
    gem 'ruby-debug19'
  end
rescue Gem::LoadError
  puts "no debug for you"
end

No comments:

Post a Comment