Commit f42501c8732442191322de3676fae4cd9fcbbaaf
- Date: Thu Apr 17 05:43:56 +0000 2008
- Committer: Dr Nic Williams (drnicwilliams@gmail.com)
- Author: Dr Nic Williams (drnicwilliams@gmail.com)
- Commit SHA1: f42501c8732442191322de3676fae4cd9fcbbaaf
- Tree SHA1: c31a4c7efde51ebe119919479fc6aff6ee2d6e1d
display nice msg if no rubygem found
Commit diff
| |   |
| 10 | 10 | require 'rubygems' |
| 11 | 11 | |
| 12 | 12 | target_gem = ENV['TM_CURRENT_WORD'] |
| 13 | | gem_path = Gem.source_index.find_name(target_gem).last.full_gem_path |
| 14 | | %x{open -a TextMate #{gem_path}} |
| 15 | | </string> |
| 13 | if gem_spec = Gem.source_index.find_name(target_gem).last |
| 14 | gem_path = gem_spec.full_gem_path |
| 15 | %x{open -a TextMate #{gem_path}} |
| 16 | else |
| 17 | puts "No RubyGem with name '#{target_gem}'" |
| 18 | end</string> |
| 16 | 19 | <key>fallbackInput</key> |
| 17 | 20 | <string>word</string> |
| 18 | 21 | <key>input</key> |
| toggle raw diff |
--- a/Commands/Go to rubygem.tmCommand
+++ b/Commands/Go to rubygem.tmCommand
@@ -10,9 +10,12 @@
require 'rubygems'
target_gem = ENV['TM_CURRENT_WORD']
-gem_path = Gem.source_index.find_name(target_gem).last.full_gem_path
-%x{open -a TextMate #{gem_path}}
-</string>
+if gem_spec = Gem.source_index.find_name(target_gem).last
+ gem_path = gem_spec.full_gem_path
+ %x{open -a TextMate #{gem_path}}
+else
+ puts "No RubyGem with name '#{target_gem}'"
+end</string>
<key>fallbackInput</key>
<string>word</string>
<key>input</key> |