Skip to end of metadata
Go to start of metadata
Contents

Overview

Studio allows the user to convert an existing Textmate bundle into a Ruble. The process converts a significant percentage of the original content, but may require substantial additional work to finish the conversion.

Performing the conversion

  1. Download a copy of the *.tmbundle file to your computer
  2. Open Studio and select Commands > Bundle Development > Convert Textmate Bundle
  3. Navigate to the bundle you downloaded above. Click "Open".
    The bundle is converted to a ruble project and opened in your workspace

This creates a default Ruble structure, moving some core elements into a bundle.rb file (including the menu definitions), and snippets and commands into their own folders.

Not currently supported or converted

  • Drag Commands
  • Langauge definitions
  • Macros
  • Preferences
  • Templates

Debugging

You will want to check your Scripting Console output for any compilation errors. It should work without issue, though it's possible the original bundle had some errors. We also suggest turning up the level of errors to Warning using the Troubleshooting control panel. Errors with snippets will then appear in your log file.

Converting commands

Snippets are converted from the individual .tmSnippet file into a file under the commands folder automatically. For example:

Open Remote Site Root.tmCommand

commands/open_remote_site_root.rb

In general, most commands are converted over without issue, though they may depend on platform-specific functionality, in particular shell scripts. If you like, those can be rewritten in Ruby to make them cross-platform.

Converting file associations

The converter will create a default set of scope to file extension mappings, based on the bundle definition, for example:

This results in a Studio content type association whereby a file named test.txpml will be opened in the "Studio Text Editor". If you wish to map the files to be opened by a different editor, such as the HTML editor, see below.

Converting snippets

Snippets are converted from the individual .tmSnippet file into a block in snippets/snippets.rb automatically.

Tag Attribute Return.tmSnippet

snippet.rb

Some Textmate snippet features are not supported, in particular nested tab stops, and search/replace regular expressions. Many of these expressions can be simplified, but exact functionality is not always available. For example:

The second ${3/\/|(.+)/(?1:<\/txp\:permlink> )/} where it does a transformation on the mirrored value of $3 is not possible. It may be easier to introduce an extra tab stop for situations like this.

Converting templates

A template will be converted into two pieces, a .txaml and a .plist piece

id.title.txaml

info.plist

See here on how to set up a proper project structure for templates. In short, the process is:

  1. Create a new "templates" sub folder
  2. Create a new file to hold the template content (say id.title.txaml)
  3. paste in the following content to id.title.txaml:
  4. Add the following to the bottom of your bundle.rb file, before the last "end":
  5. Save bundle.rb

If you now choose File > New From Template > Bundle Name > ID.Title Template it will allow you to create a new template of the type specified above.

Icon

We had to switch TM_USER to USER as "TM_USER" is not a supported variable

Associating new file extensions with an existing editor

As an example, say we convert the Textpattern bundle and wish to use it to edit *.txpml files containing a mix of HTML and Textpattern syntax. We want to use the HTML editor. Follow the instructions [here|Changing your file association preferences} for further information.