(Re)Enable TextMate Ruby Bundle
We all love TextMate, by all means. It is the best friend for Ruby Developers.
After our project upgraded to Rails 2.0+ at LearnHub.com, I noticed that there are some very powerful Ruby Bundle Commands just stopped working. Especially these two:
- Run Focused Unit Test
This is an awesome lovely command in Ruby Bundle, absolutely my favorite! It allows you to run a single unit test out of a whole suite of tests by simply positioning your cursor into the test you’d like to run.
- Run Rake Task
This is another cool command too. It shows a popup window which list all the available rake tasks you have and it will show a pretty HTML result window after you choose from the list.
This thing really bothers me a lot. I could be fine for the second one, as I do have terminal windows open all the time. But I really really miss the first one, as our test files get longer very soon.
I have to make it work!
After couple of hours trying today, I’ve pretty much got the right reason and the simple solution, for now.
The reason is that TextMate includes its own version of builder.rb, which is conflicting with Rails 2.0′ version of builder.rb.
The simple solution:
- Open TextMate Bundlers Editor
- Find Ruby -> Run Focused Unit Test
- Search for RUBYLIB=”$TM_BUNDLE_SUPPORT/RakeMate${RUBYLIB:+:$RUBYLIB}”
- Change to RUBYLIB=”$TM_BUNDLE_SUPPORT/RakeMate”
- Reload Bundlers
That’s it! And apply the same changing method to other commands such as “Run Rake Task” as well.
And just want to point out the alternate solution is:
mv /Applications/TextMate.app/Contents/SharedSupport/Support/lib/Builder.rb /Applications/TextMate.app/Contents/SharedSupport/Support/lib/Builder.rb.bak
It’s up to you to choose one of them.
Hope Google can pickup this post quickly so we can save somebody else sometime too.
Enjoy!
Libin,
You can run individual tests from the command line… check out my friend Shanti’s post here:
http://shanti.railsblog.com/how-to-run-a-single-test-in-rails
John
Thanks John!
ruby test/unit/unit_test.rb –name test_method
works really well, and I just notice the Ruby Bundle is using the same solution too.
Well, it is still a little more convenient with TextMate Ruby Bundle.
Libin, thanks for the tip! I too was missing the “Run Focused Unit Test” feature.
I had to change line to “RubyMate”, like your screenshot, not “RakeMate”, like the accompanying text, for it to work.
-Rob