[TxMt] Re: TM2 bundle dependencies
Allan Odgaard
mailinglist at textmate.org
Tue Jun 26 14:39:04 UTC 2012
On 29/05/2012, at 20.56, Matthew Johnson wrote:
> I just checked the Ruby Haml bundle in TM2 preferences and it automatically pulled in the Rails bundle when I did that. Is there a dependency mechanism for bundles in TM2? If so, how is that declared?
There are “implicit” dependencies, which are when a grammar include stuff from other grammars.
There are also “explicit” dependencies which you declare in the property list of the item that depends on something else (can be the bundle’s info.plist).
> Is it possible to find the correct bundle support path for a bundle you are dependent on? Is path manipulation the best way to do that or is there something better?
This is from Objective-C.tmbundle/info.plist:
require = (
{ name = "C";
uuid = "4675A940-6227-11D9-BFB1-000D93589AF6";
},
);
This allow commands in the Objective-C bundle to reference the C bundle’s support folder via the TM_C_BUNDLE_SUPPORT environment variable.
There is also an alternative approach, although this should generally not be used, but e.g. the SCM bundle has this settings item:
{ shellVariables = (
{ name = 'TM_SCM_COMMIT_WINDOW';
value = '$TM_BUNDLE_SUPPORT/bin/CommitWindow.app/Contents/MacOS/CommitWindow';
},
);
}
This globally exposes the TM_SCM_COMMIT_WINDOW variable (for all bundle commands to see) with a path inside the SCM bundle. We did it this way because it hides where in the support folder the binary is. Another use for this though is the Themes bundle which appends to the global TM_THEME_PATH variable (used for web output themes) via the following settings item:
{ shellVariables = (
{ name = 'TM_THEME_PATH';
value = '${TM_THEME_PATH:+$TM_THEME_PATH:}$TM_BUNDLE_SUPPORT/web-themes';
},
);
}
More information about the textmate
mailing list