It’s official, folks!

After talking with my partner, Greg Narain, as well as Allan Odgaard, the creator of TextMate, we (syncPEOPLE) have decided to release our Rails bundle under the MIT license so that it can nest itself nicely within its new home, the TextMate Subversion Bundle Repository. If you have subversion set up with TextMate, update your bundles and you’ll get it all.

What this means for the rest of us is that all of these great features we’ve been madly developing are going to be available as the default Rails bundle when the next version of TextMate is released. Thanks to all who’ve contributed to this work already. Keep it up!

Changes in the 1.0 Release Candidate

There are some major key binding changes in this release, due to my own slow but steady understanding of TextMate conventions and the evolving complexity of making this intuitive. Bundle keys are normally bound to the ctrl-shift combination, not the command-option combination. Therefore, in following with this convention, the new bundle uses the following bindings for its commands:

  • ⌘⌥↓: Intelligent Go To File
  • ⌘⌥⇧↓: Show “Go To File” Choices
  • ⌘⌥↑: Go To File on Current Line
  • ⌃⇧” (without selected text): Inline Partial Edit Mode
  • ⌃⇧” (with selected text): Create Partial from Selection
  • ⌃⇧\: Call Generator Script
  • ⌃⇧\: Install Plugin

The Enhanced TODO List has been moved to the TODO bundle itself, so everyone (Rails and non-Rails folks alike) will benefit from it. It will be updated soon.

New Language Scoping

In order to create the “Show Go To File Choices” command and its list of choices, I created some new language scoping rules in TextMate that may prove interesting in the future. Basically, there are 6 new scopes available for Rails bundle creators to play with:

  • meta.rails.functional_test
  • meta.rails.controller
  • meta.rails.helper
  • meta.rails.mailer
  • meta.rails.model
  • meta.rails.unit_test

What this amounts to is that you can bind certain snippets, commands or macros to specific scopes within the rails project. For example, suppose you want to create a macro that adds scaffolding code to your controller. With the new scopes, you can bind your command to meta.rails.controller and rest assured that you won’t accidentally add scaffold actions to your model. In addition, this new scoping allows you to bind multiple commands with the same key binding to a single scope to create a pop-up menu with choices. Try ⌘⌥⇧↓ to see this latter benefit in action.

What About the ‘Keypad Enter’ Key Binding?

After some discussion, we (Allan and I) decided to remove the keypad enter binding and replace it with the ⌘⌥↓ key combination. There were a number of reasons for doing this:

  • ⌘⌥↓ has been bound to a similar function, rails-open-partner, for some time already.
  • The keypad enter key doesn’t work on PowerBooks and iBooks without some tweaking.
  • The keypad enter key is already bound to a global next-line action.

With that said, however, there’s certainly nothing stopping you from re-binding the enter key to your Rails bundle. If it works for you that way, great!

Final Words

I’ve put a lot of work in to making this release a much more robust, refactored release. There are some really handy classes that have been created just for TextMate (included in the bundle) that I’d like to mention for the benefit of other bundle makers:

  1. TextMate Module: Namespace module for message functions, opening text files in textmate, and exiting with special exit codes that TextMate understands.
  2. Buffer Class: Reads in a text file and provides search functionality as well as state information (such as current line and current column number).
  3. RailsPath Class: Understands the Rails app directory structure and provides a way to easily swap between associated files. For example, calling rails_path_for(type) on a controller file will pass back the full path (wrapped in a RailsPath object) of any associated helper file or functional test file.
  4. UnobtrusiveLogger Class: Use $logger.debug “(your message here)” to send output to ~/textmate_bundle.log.
  5. String Class Modifications: See misc.rb for mods to String

Get it now!

If you don’t use the subversion repository, download the new Rails bundle as a Disk Image here.


Download the Disk Image
TextMate Rails Bundle 1.0 RC1