1

I want to change the textmate bundle "Create Partial From Selection", which depends on a file called "create_partial_from_selection.rb".

I have changed the above file so it outputs double, not single quotes. Problem is i don't know where to put this edited file. I tried putting my edited file in ~/Library/Application Support/TextMate/Bundles, but this file has dependencies, which in turn have more dependencies, so that didn't really work.

Any pointers please?

pingu
  • 8,719
  • 12
  • 50
  • 84

1 Answers1

1

Disclaimer: I have never actually done anything regarding bundle creation/editing for textmate. These are just suggestions based on what I was able to glean looking through them.

The directory (for my bundle) that the source code is in is here:

~/Library/Application Support/TextMate/Bundles/Ruby On Rails.tmbundle/Support/bin

If you open textmate, then click "Bundles" in the menu bar, then "Bundle Editor", then "Show Bundle Editor", you'll see a list of all your bundles and can get to all the actions within them. Under "Create Partial from Selection", I have the following:

RUBYLIB="$TM_BUNDLE_SUPPORT/lib:$RUBYLIB"
"${TM_RUBY:=ruby}" -- "${TM_BUNDLE_SUPPORT}/bin/create_partial_from_selection.rb"

I have no idea what best practice dictates for this, but it seems like you have two options:

  1. Change the path in Bundle editor from "${TM_BUNDLE_SUPPORT}/bin/create_partial_from_selection.rb" to something else (perhaps "${TM_BUNDLE_SUPPORT}/bin/create_partial_from_selection_double_quotes.rb" ?). Then drop your new file in the same directory alongside the original. I suppose you could also make your own action in bundle editor with all the same settings for a completely separate command. With this option you'll keep the original source code (good in case you accidentally introduced a hard to track down bug).

  2. Overwrite create_partial_from_selection.rb in the bundle directory with your new file. Probably faster, but you lose the original command in bundle editor. I probably would suggest making a backup of the original, but you could also find it online or re-download the bundle pretty easily, so maybe not as big a deal to you if you always have internet access.

Good luck!

Brett Bender
  • 19,388
  • 2
  • 38
  • 46
  • Thanks for the reply Brett, the problem with your solution is that those changes will get scrubbed if a new version of TextMate is released (unlikely I know) On the other hand, I can't see a better way of accomplishing this. – pingu Jun 14 '11 at 07:42
  • I don't have any idea if that's true or not, my guess is as long as the Ruby on Rails bundle isn't changed in between textmate versions, it will be fine. It's also possible that updating a bundle would not ruin your changes as long as you follow option 1 and create a new command via bundle editor (instead of changing the path for the original command) – Brett Bender Jun 14 '11 at 15:23
  • Many of the bundles are up on github now. (This Ruby on Rails bundle is official and in svn.textmate.com/trunk/Bundles however.) You can clone it, modify the script in your clone, disable the built-in bundle, and install your clone. There's no official best practice AFAIK, but improving the bundle and sharing your work on github seems pretty close. – IAmNaN Apr 01 '12 at 19:41