Dr Nic's Journey

The small things in my day so I don't clutter the Dr Nic site.

Areas of interest: Ruby, Rails, JavaScript, Editors, and my life in general.

Subscribe:

Dr Nic Blog:

Load up any Gem into editor

Create an executable script called find_gem:

#!/usr/bin/env ruby

require 'rubygems'

if ARGV.first
  gem_path = Gem.source_index.find_name(ARGV.first).last.full_gem_path
else
  gem_path = Gem.source_index.find_name('sources').last.full_gem_path.split('sources').first
end

print gem_path
Now you can load up any gem’s source into your editor:
mate `find_gem hpricot`