Textmate - fix filetype recognition issues with RSpec and Rails bundles.

Over time i have collected several ruby related textmate bundles which i have enjoyed tweaking for easier usage. During this time I somehow managed to mangle my file type recognition settings. I first noticed this problem by losing the ability to use the shortcut keystroke to execute rspec tests.

The solution lies in this textmate blog post: http://blog.macromates.com/2007/file-type-detection-rspec-rails

In summary i did the following:

Closed textmate completely and deleted the related manual textmate bindings for these languages with the following command in the terminal:

defaults delete com.macromates.textmate OakLanguageFileBindings

Next I changed the way textmate viewed ownership of the .rb file extension. I specifically revoked it from the Ruby bundle and enforced the ownsership in the RubyOnRails bundle.

Opened textmate and navigate to Bundles -> Bundle Editor -> Edit Languages and added rb to the Ruby on Rails grammar’s fileTypes array so that it reads:

fileTypes = ( 'rb', 'rxml', 'builder' );

Note: These are the values in my RubyOnRails language settings. Yours may differ but the important entry is ‘rb‘. Make sure its included in the list.

Next, I navigated to the Ruby Bundle -> Language settings in similar fashion and REMOVE the ‘rb’ file type from the list. There was a large amount of text to sort through in looking for this setting so i simply copied all to a text window, searched and replaced then pasted back into the textmate language definition window.

At this point the filetypes were registering fine for rspec tests and ruby/rails filetypes. I checked this by watching the status bar - filetype setting display.

The Buzz {1 trackbacks/pingbacks}

  1. Pingback: links for 2008-07-02 | Libin Pan on July 2, 2008

Speak Your Peace

  • Comment Policy:Could go here if there's a nagging need Login Instructions: Would go here if there's a desire.