[TxMt] Calling a command from a command.

Dru Kepple dru at summitprojects.com
Tue Oct 27 00:52:02 UTC 2009


This has been covered before ( http://lists.macromates.com/textmate-dev/2009-May/013933.html ), so I'm not hopfeul, but I thought it was worth asking again, in case anything has changed.  Probably not.

The responders to the thread linked above recommend writing Ruby modules and stuff, which I do when I'm working on a bundle, but what if I have a bundle and I want to call another bundle's commands?

Fortunately, I'm in control of both bundles, but for organizational and responsibility reasons, I don't want to combine them.  One is very utilitarian (basic FTP) and the other is extremely specific (stuff related to a single project I work on, has absolutely no relevance to anything outside of the project).  The good news is that I already have my bundles set up to be somewhat modular/class-driven.

I realize that doing this creates dependencies between bundles, but I'm OK with this, and feel it's better than recreating my FTP commands in another bundle.

One thought I had would be to get the TM_BUNDLE_SUPPORT value, pop off the bundle name and replace it with the bundle name of the target, and get to the Ruby file I need.  But then...wouldn't any TM_BUNDLE_SUPPORT values used in the other bundle's scripts evalulate to the wrong place?

Would it be better to find a place for such universally appealing ruby files outside of TextMate?  Should I learn how to write plugins, and/or deposit code into the SUPPORT_PATH?

The original poster's idea seems close to my idea.  But it would be sweet to be able to do something like:

require ENV['TM_SUPPORT_PATH'] + '/lib/bundle_access'
BundleAccess.executeCommand("Some Bundle", "Some Command", argin)

Or something that could safely instantiate Ruby objects from other bundles to allow them to be used in your bundle without mucking with the BUNDLE_SUPPORT value.

I don't know...just spitballing.

Thanks,
Dru
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20091026/7fefb336/attachment.html>


More information about the textmate mailing list