Playing with TextMate is fun, but I can't find any bundle that can make running a single-file unit test or functional test easily.
So I want to custom a command:
-
By pressing
, TextMate will figure out which test to run.
When the opened file is
app/controllers/abc_controller.rb
, the test file istest/functional/abc_controller_test.rb
When it becomes
app/models/abc.rb
then test file should betest/unit/abc_test.rb
-
By clicking the error message, I can google it (maybe plus a word "ruby")
-
By clicking the trace, I can navigate to the correct file and correct line
A screenshot: (Just like a vim plugin for ruby test)
Thanks to the Very Decently Composed Introduction of TextMate Commands, it's easy!
A TextMate command is simply a script, which may be executed by bash, ruby, python, applescript ... Editor state is saved in environment variables such as $TM_FILEPATH.
-
To read some text input from current selection, just change the
input
field and read from stdin -
To link to a page in web browser, use a link with TextMate specific javascript:
<a href='javascript:TextMate.system("open http://the.page.you.want", null)'>text you see</a>
-
To link to a file opened or not opened in TextMate:
<a href='txmt://open?url=*file_path*&line=*line_number*'>text you see</a>