boiling memoir

journey of one man

My Shortcut to Open Any Gem in TextMate With 1 Command

Using the implementation from @peepcode’s blog on shell method missing as a base. I have added another action (code snippet below) to open a gem library in TextMate by typing in the name of the gem followed by “.mate”.

1
2
3
4
5
6
when /^[A-Za-z0-9_\-\/]+\.mate$/
  # Open the gem in textmate
  # @example
  #   haml.mate
  gem_to_open = command.first.gsub(/\.mate$/, '')
  run "gem which #{gem_to_open} | tail -1 | xargs dirname | sed -e's/$/\\/../' | xargs mate"