Permalink
Browse files

Merge branch 'release'

  • Loading branch information...
2 parents f46595c + e6501c5 commit 80cae41a4b0e330ef1d038bd294a59c7c463869e @timcharper timcharper committed Apr 24, 2008
@@ -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>
@@ -15,6 +15,8 @@ term.do_script "cd #{ENV['TM_PROJECT_DIRECTORY'].to_s.inspect}"
</string>
<key>input</key>
<string>none</string>
+ <key>keyEquivalent</key>
+ <string>^@p</string>
<key>name</key>
<string>Project terminal</string>
<key>output</key>
View
@@ -0,0 +1,18 @@
+require 'rubygems'
+require 'rake'
+require 'rake/testtask'
+
+APP_NAME='RubyAMP.tmbundle'
+APP_ROOT=File.dirname(__FILE__)
+
+RUBY_APP='ruby'
+
+desc "TMBundle Test Task"
+task :default => [ :test ]
+Rake::TestTask.new { |t|
+ t.libs << "test"
+ t.pattern = 'Support/test/test_*.rb'
+ t.verbose = true
+ t.warning = false
+}
+Dir['Support/tasks/**/*.rake'].each { |file| load file }
@@ -0,0 +1,29 @@
+require 'rubygems'
+$:.unshift "#{ENV['TM_BUNDLE_SUPPORT']}/lib"
+require "ruby_tm_helpers"
+require "grep_helpers"
+# DEMO TARGET: require 'hpricot'
+# DEMO TARGET: require 'ruby-debug'
+# DEMO TARGET: require 'map_by_method'
+
+module GoToExternal
+ extend self
+ # Returns the path of the project or file that best
+ # matches the context of where the cursor/caret is currently
+ def run
+ target_gem = target_term #ENV['TM_CURRENT_WORD']
+ if gem_spec = Gem.source_index.find_name(target_gem).last
+ gem_path = gem_spec.full_gem_path
+ tm_open gem_path
+ else
+ puts "No RubyGem with name '#{target_gem}'"
+ end
+ end
+
+ def target_term
+ filepath = tm_expanded_selection(
+ :backward => /[\w\/.-]+/,
+ :forward => /[\w\/.-]+/
+ ).strip
+ end
+end
@@ -42,11 +42,11 @@ def tm_open(file, options = {})
file = $1
line = $2
end
-
+
unless /^\//.match(file)
file = File.join((ENV['TM_PROJECT_DIRECTORY'] || Dir.pwd), file)
end
-
+
args = []
args << "-w" if wait
args << e_sh(file)
@@ -58,7 +58,7 @@ def tm_open(file, options = {})
def tm_expanded_selection(options = {})
text=ENV['TM_SELECTED_TEXT'].to_s
return text unless text.empty?
-
+
options = {
:input_type => :doc,
:input => nil,
@@ -67,19 +67,19 @@ def tm_expanded_selection(options = {})
:line_number => ENV['TM_LINE_NUMBER'].to_i,
:col_number => ENV['TM_COLUMN_NUMBER'].to_i
}.merge(options)
-
+
col_number, line_number = options[:col_number], options[:line_number]
-
+
doc = options[:input] ||= $stdin.read
-
- line =
+
+ line =
case options[:input_type]
when :doc then doc.split("\n")[line_number - 1].to_s
when :line then doc
- else
+ else
raise "Can't handle input_type #{options[:input_type]} for tm_expanded_selection"
end
-
+
last_part = line[ (col_number - 1)..-1]
first_part = line[ 0..col_number - 2]
@@ -0,0 +1,8 @@
+require File.dirname(__FILE__) + "/test_helper"
+require "go_to_external"
+
+class TestGoToExternal < Test::Unit::TestCase
+ def test_case_name
+
+ end
+end
@@ -0,0 +1,4 @@
+require "test/unit"
+
+$:.unshift File.dirname(__FILE__) + "/../lib"
+$:.unshift File.dirname(__FILE__) + "/../bin"
View
@@ -13,11 +13,12 @@
<string>C2B791CB-A363-4795-8722-B13D1AC082E9</string>
<string>5A794E77-05F6-4BF9-A2C3-C43D81FA35E6</string>
<string>110CE952-DD36-476D-BC13-48B3D906334D</string>
- <string>7B7488CD-ACC9-49F9-BE91-B3150326C3D0</string>
<string>5011F1E1-74CF-4D63-B901-1E2FB7760AFE</string>
<string>C3447304-B1F3-4500-9F00-B025D9520BB0</string>
<string>7BEFC54B-D3FD-4B88-916A-2E80304D5CD2</string>
<string>3E287237-8082-4068-8B31-0F814338710E</string>
+ <string>90E13791-96CC-4380-8344-48EB84D9E616</string>
+ <string>6472BE24-D59B-46E3-A2AC-8B6B15621C9D</string>
</array>
<key>submenus</key>
<dict>
@@ -45,6 +46,7 @@
<string>E2D2F075-81CE-4604-9813-A08145995F96</string>
<string>23D5F39E-73CA-43FC-90B3-18BDBEDDD56B</string>
<string>7443155B-3A9B-4B0A-8D3D-0B533B3B9125</string>
+ <string>5DB5FB44-7052-4D3C-8FB8-2B950BEBC6AE</string>
</array>
<key>name</key>
<string>Quick - Navigate</string>
@@ -97,10 +99,12 @@
<string>E2D2F075-81CE-4604-9813-A08145995F96</string>
<string>23D5F39E-73CA-43FC-90B3-18BDBEDDD56B</string>
<string>7443155B-3A9B-4B0A-8D3D-0B533B3B9125</string>
+ <string>5DB5FB44-7052-4D3C-8FB8-2B950BEBC6AE</string>
<string>5011F1E1-74CF-4D63-B901-1E2FB7760AFE</string>
<string>C3447304-B1F3-4500-9F00-B025D9520BB0</string>
<string>7BEFC54B-D3FD-4B88-916A-2E80304D5CD2</string>
<string>3E287237-8082-4068-8B31-0F814338710E</string>
+ <string>6472BE24-D59B-46E3-A2AC-8B6B15621C9D</string>
</array>
<key>uuid</key>
<string>90A97C0D-E305-4C84-93E4-DCFB2113820E</string>

0 comments on commit 80cae41

Please sign in to comment.