Skip to content

Commit

Permalink
• scan Ruby’s include path for a file named after the current word an…
Browse files Browse the repository at this point in the history
…d open it in a new window if found (mainly useful for require 'something' lines and analog to our Quick Open in C)

git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/Ruby.tmbundle@3781 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information
duff committed Jun 23, 2006
1 parent 5e52c18 commit a3086e3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Commands/Open Require.tmCommand
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//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
file = ENV['TM_CURRENT_WORD'].to_s + '.rb'
dir = $:.find { |d| File.exist?(File.join(d, file)) }
if dir &amp;&amp; file then
ENV['FILE'] = File.join(dir, file)
%x{ "$TM_SUPPORT_PATH/bin/mate" "$FILE" }
else
puts "File not found."
end
</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>@D</string>
<key>name</key>
<string>Open Require</string>
<key>output</key>
<string>showAsTooltip</string>
<key>scope</key>
<string>source.ruby</string>
<key>uuid</key>
<string>8646378E-91F5-4771-AC7C-43FC49A93576</string>
</dict>
</plist>
4 changes: 4 additions & 0 deletions info.plist
Expand Up @@ -24,11 +24,13 @@
</array>
<key>items</key>
<array>
<string>35222962-C50D-4D58-A6AE-71E7AD980BE4</string>
<string>8C102BE9-6E49-11D9-A933-000D93589AF6</string>
<string>5289EE40-86B8-11D9-A8D4-000A95E13C98</string>
<string>569C9822-8C41-4907-94C7-1A8A0031B66D</string>
<string>------------------------------------</string>
<string>63F3B3B7-CBE2-426B-B551-657733F3868B</string>
<string>8646378E-91F5-4771-AC7C-43FC49A93576</string>
<string>EE5F19BA-6C02-11D9-92BA-0011242E4184</string>
<string>------------------------------------</string>
<string>EE5F1FB2-6C02-11D9-92BA-0011242E4184</string>
Expand Down Expand Up @@ -348,12 +350,14 @@
<string>Ruby</string>
<key>ordering</key>
<array>
<string>35222962-C50D-4D58-A6AE-71E7AD980BE4</string>
<string>8C102BE9-6E49-11D9-A933-000D93589AF6</string>
<string>5289EE40-86B8-11D9-A8D4-000A95E13C98</string>
<string>569C9822-8C41-4907-94C7-1A8A0031B66D</string>
<string>EE5F19BA-6C02-11D9-92BA-0011242E4184</string>
<string>76FCF165-54CB-4213-BC55-BD60B9C6A3EC</string>
<string>63F3B3B7-CBE2-426B-B551-657733F3868B</string>
<string>8646378E-91F5-4771-AC7C-43FC49A93576</string>
<string>EE5F1FB2-6C02-11D9-92BA-0011242E4184</string>
<string>FBFC214F-B019-4967-95D2-028F374A3221</string>
<string>1AD6A138-2E89-4D6A-AB3F-416BF9CE968D</string>
Expand Down

0 comments on commit a3086e3

Please sign in to comment.