Jump to content

Simple Workflow for: Select Text => modify selection with Ruby => open URL

Recommended Posts

Hey guys


I have a lot of output in my console which looks like this:

  1) Calendars offers a link to create a new event
     Failure/Error: page.should have_link 'Erfassen'
       expected there to be content "Erfassen" in "Termine\nKALENDER\nGeschäftskalender\nArbeitszeiten\nGeburtstage\n ◄ \n ► \nHeute\n13. — 19. Mai 2013\nMonat\nWoche\nTag\n  Mo 13.5. Di 14.5. Mi 15.5. Do 16.5. Fr 17.5. Sa 18.5. So 19.5.  \n                    0\n              1\n              2\n              3\n              4\n              5\n              6\n              7\n              8\n              9\n              10\n              11\n              12\n              13\n              14\n              15\n              16\n              17\n              18\n              19\n              20\n              21\n              22\n              23\n             "
     # ./spec/requests/calendars/calendars_spec.rb:15:in `block (3 levels) in <top (required)>'
     # ./spec/requests/calendars/calendars_spec.rb:14:in `block (2 levels) in <top (required)>'

 1/1 |================================================== 100 ===================================================>| Time: 00:00:51 

Finished in 52.74 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/requests/calendars/calendars_spec.rb:11 # Calendars offers a link to create a new event

What I'd like to do is the following:


* 3x click on a line with a file path, which selects the whole line ("     # ./spec/requests/calendars/calendars_spec.rb:15:in `block (3 levels) in <top (required)>'")

* Press a key combination which opens the selected path in TextMate2


I use TextMate's txmt:// protocol to open the file, but since the selected text is no valid file path yet, it doesn't work. So I have to modify the selection to clean the unneeded stuff out of the string. I'd like to use Ruby as I know the language pretty well and want to use its RegExp functionalities.


So far, I managed to create a Hotkey (Ctrl-Cmd-O) that takes the selected text, and I found the "Open URL" action. But the string cleaning stuff is a bit strange to me - how should I do it? I tried a "Script Filter", but I'm not sure whether this is the right thing. I tried to do some stuff in the `Script` textarea, but how do I modify the {query} that is passed on to "Open URL"?


Thanks a lot,


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...