Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding a drag command for requiring Ruby files.

git-svn-id: http://svn.textmate.org/trunk/Bundles/Ruby.tmbundle@10197 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
commit a18ccd413a76d7012275a920f518982d2914f2c2 1 parent 6f1158b
James Edward Gray II JEG2 authored
39 DragCommands/Require Ruby File.tmDragCommand
... ... @@ -0,0 +1,39 @@
  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 -wKU
  9 +
  10 +require 'pathname'
  11 +
  12 +require "#{ENV['TM_SUPPORT_PATH']}/lib/escape.rb"
  13 +
  14 +from_path = Pathname.new(ENV['TM_FILEPATH'] || '.').dirname.realpath
  15 +to_path = Pathname.new(ENV['TM_DROPPED_FILE']).realpath
  16 +begin
  17 + path = to_path.relative_path_from(from_path)
  18 +rescue ArgumentError
  19 + path = to_path
  20 +end
  21 +lib = path.to_s.sub(/\.rb\z/i, '')
  22 +puts %Q{require "#{e_sn(lib).gsub('"', '\"')}"}
  23 +</string>
  24 + <key>draggedFileExtensions</key>
  25 + <array>
  26 + <string>rb</string>
  27 + </array>
  28 + <key>input</key>
  29 + <string>selection</string>
  30 + <key>name</key>
  31 + <string>Require Ruby File</string>
  32 + <key>output</key>
  33 + <string>insertAsSnippet</string>
  34 + <key>scope</key>
  35 + <string>source.ruby</string>
  36 + <key>uuid</key>
  37 + <string>C122CD92-DDBE-4869-9C7A-CC2B254C9411</string>
  38 +</dict>
  39 +</plist>
3  info.plist
... ... @@ -1,5 +1,5 @@
1 1 <?xml version="1.0" encoding="UTF-8"?>
2   -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 3 <plist version="1.0">
4 4 <dict>
5 5 <key>contactEmailRot13</key>
@@ -426,6 +426,7 @@
426 426 <string>97054C4D-E4A3-45B1-9C00-B82DBCB30CAD</string>
427 427 <string>6519CB08-8326-4B77-A251-54722FFBFC1F</string>
428 428 <string>47D203ED-EB9B-4653-A07B-A897800CEB76</string>
  429 + <string>C122CD92-DDBE-4869-9C7A-CC2B254C9411</string>
429 430 <string>7990EE60-C850-4779-A8C0-7FD2C853B99B</string>
430 431 <string>121B334B-2AA6-4E9A-A8B8-BF93B627982B</string>
431 432 <string>58FDEA60-10AF-4C49-AA09-29B77030DB25</string>

0 comments on commit a18ccd4

Please sign in to comment.
Something went wrong with that request. Please try again.