Commit 3f308597d4f1368b986f28f0e6b323504e313e4a
- Date: Thu Apr 17 08:27:27 +0000 2008
- Committer: Dr Nic Williams (drnicwilliams@gmail.com)
- Author: Dr Nic Williams (drnicwilliams@gmail.com)
- Commit SHA1: 3f308597d4f1368b986f28f0e6b323504e313e4a
- Tree SHA1: bee827354f8c6872e7a550c1488b0842877a9ffd
renamed Go to Rubygem; moved code into library
Commit diff
| |   |
| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | <plist version="1.0"> |
| 4 | <dict> |
| 5 | <key>beforeRunningCommand</key> |
| 6 | <string>nop</string> |
| 7 | <key>command</key> |
| 8 | <string>#!/usr/bin/env ruby |
| 9 | require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/go_to_external.rb" |
| 10 | |
| 11 | GoToExternal.run</string> |
| 12 | <key>fallbackInput</key> |
| 13 | <string>word</string> |
| 14 | <key>input</key> |
| 15 | <string>document</string> |
| 16 | <key>keyEquivalent</key> |
| 17 | <string>~G</string> |
| 18 | <key>name</key> |
| 19 | <string>Go to External File/RubyGem</string> |
| 20 | <key>output</key> |
| 21 | <string>showAsTooltip</string> |
| 22 | <key>uuid</key> |
| 23 | <string>5DB5FB44-7052-4D3C-8FB8-2B950BEBC6AE</string> |
| 24 | </dict> |
| 25 | </plist> |
| toggle raw diff |
--- /dev/null
+++ b/Commands/Go to External File-RubyGem
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>#!/usr/bin/env ruby
+require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/go_to_external.rb"
+
+GoToExternal.run</string>
+ <key>fallbackInput</key>
+ <string>word</string>
+ <key>input</key>
+ <string>document</string>
+ <key>keyEquivalent</key>
+ <string>~G</string>
+ <key>name</key>
+ <string>Go to External File/RubyGem</string>
+ <key>output</key>
+ <string>showAsTooltip</string>
+ <key>uuid</key>
+ <string>5DB5FB44-7052-4D3C-8FB8-2B950BEBC6AE</string>
+</dict>
+</plist> |
| |   |
| 0 | | <?xml version="1.0" encoding="UTF-8"?> |
| 1 | | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 2 | | <plist version="1.0"> |
| 3 | | <dict> |
| 4 | | <key>beforeRunningCommand</key> |
| 5 | | <string>nop</string> |
| 6 | | <key>command</key> |
| 7 | | <string>#!/usr/bin/env ruby |
| 8 | | |
| 9 | | require 'rubygems' |
| 10 | | |
| 11 | | target_gem = ENV['TM_CURRENT_WORD'] |
| 12 | | if gem_spec = Gem.source_index.find_name(target_gem).last |
| 13 | | gem_path = gem_spec.full_gem_path |
| 14 | | %x{open -a TextMate #{gem_path}} |
| 15 | | else |
| 16 | | puts "No RubyGem with name '#{target_gem}'" |
| 17 | | end</string> |
| 18 | | <key>fallbackInput</key> |
| 19 | | <string>word</string> |
| 20 | | <key>input</key> |
| 21 | | <string>document</string> |
| 22 | | <key>keyEquivalent</key> |
| 23 | | <string>~G</string> |
| 24 | | <key>name</key> |
| 25 | | <string>Go to RubyGem</string> |
| 26 | | <key>output</key> |
| 27 | | <string>showAsTooltip</string> |
| 28 | | <key>uuid</key> |
| 29 | | <string>5DB5FB44-7052-4D3C-8FB8-2B950BEBC6AE</string> |
| 30 | | </dict> |
| 31 | | </plist> |
| toggle raw diff |
--- a/Commands/Go to rubygem.tmCommand
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>beforeRunningCommand</key>
- <string>nop</string>
- <key>command</key>
- <string>#!/usr/bin/env ruby
-
-require 'rubygems'
-
-target_gem = ENV['TM_CURRENT_WORD']
-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>
- <string>document</string>
- <key>keyEquivalent</key>
- <string>~G</string>
- <key>name</key>
- <string>Go to RubyGem</string>
- <key>output</key>
- <string>showAsTooltip</string>
- <key>uuid</key>
- <string>5DB5FB44-7052-4D3C-8FB8-2B950BEBC6AE</string>
-</dict>
-</plist> |
| |   |
| 1 | require 'rubygems' |
| 2 | $:.unshift "#{ENV['TM_BUNDLE_SUPPORT']}/lib" |
| 3 | require "grep_helpers" |
| 4 | # DEMO TARGET: require 'hpricot' |
| 5 | |
| 1 | 6 | class GoToExternal |
| 2 | 7 | # Returns the path of the project or file that best |
| 3 | 8 | # matches the context of where the cursor/caret is currently |
| 4 | 9 | def self.run |
| 5 | | |
| 10 | target_gem = ENV['TM_CURRENT_WORD'] |
| 11 | if gem_spec = Gem.source_index.find_name(target_gem).last |
| 12 | gem_path = gem_spec.full_gem_path |
| 13 | %x{open -a TextMate #{gem_path}} |
| 14 | else |
| 15 | puts "No RubyGem with name '#{target_gem}'" |
| 16 | end |
| 6 | 17 | end |
| 7 | 18 | end |
| toggle raw diff |
--- a/Support/lib/go_to_external.rb
+++ b/Support/lib/go_to_external.rb
@@ -1,7 +1,18 @@
+require 'rubygems'
+$:.unshift "#{ENV['TM_BUNDLE_SUPPORT']}/lib"
+require "grep_helpers"
+# DEMO TARGET: require 'hpricot'
+
class GoToExternal
# Returns the path of the project or file that best
# matches the context of where the cursor/caret is currently
def self.run
-
+ target_gem = ENV['TM_CURRENT_WORD']
+ 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
end
end
\ No newline at end of file |