Editing a bundle in TextMate
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 开发者_如何学Pythonhave more dependencies, so that didn't really work.
Any pointers please?
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:
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).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!
精彩评论