Setting ruby executable path in TextMate

I just recently received an update to TextMate.  However, I discovered that I could no longer Run Focused Unit Test as it would complain:

in `check_gem_dependencies': undefined method `ruby_version' for Gem:Module (NoMethodError)

I got a clue when I noticed in the RubyMate window that the patch level of the ruby interpreter was different from the patch level of the ruby I use from a Terminal window.  Clearly, TextMate was using a different Ruby executable than I was the rest of the time.

I poked around in the Ruby bundle a little bit and noticed references to a variable TM_RUBY.  Looking around some more, I discovered in the Preferences under Advanced there is a Shell Variables tab.  I added a TM_RUBY variable there and pointed it to the ruby I wanted it to use (/usr/local/bin/ruby in my case).  Restarted TextMate, et voilà — Run Focused Unit Test works perfectly again.

Option + Drag + Quote

Yet another reason I love TextMate:


You may or may not know that when you have text selected in TextMate and you press the quotation mark it will surround the selection with quotation marks (instead of replacing the selection with a single quotation mark).


Also, you may or may not know that you can select an arbitrary rectangle of text in your code by option-click-dragging across multiple rows/columns.  Then anything you type replaces what you’ve selected on every line.


Putting these two features of TextMate together, if you have option-selected some text on multiple lines, and some of the lines have trailing space selected, then you press quotation mark, it does the Right Thing by placing the quotation mark before the trailing space on each line, as opposed to at the end of the selection on every line.  Very cool.


OK, it doesn’t read very well, so try it out yourself to find out what I’m talking about.  In the case where I was copying data from a spreadsheet into my Ruby code and needed to quote the values that I copied in, it was a huge time saver.