textmate

TextMate 2 got recently open-sourced and with that I reverted the decision to switch to Sublime Text 2.
Sublime Text indeed has some edge over TextMate, but overall I believe TM is a more mature editor.
TM2 has been showing a lot traction lately with several nightly builds being delivered in the last weeks.
That being said, I really missed one thing from Sublime, and that was running rspec tests on the terminal with a command.
This was done using a technique I found on Code Climate’s Blog (excellent post btw) .
So I decided to replicate that behaviour. Basically I just copied over the applescript file responsible for opening the terminal and executing the command, and with ruby, worked with the TM environment variables to send the proper command.

1
2
3
4
5
6
7
8
9
10
#!/usr/bin/env ruby -wKU
ENV['TM_SUPPORT_PATH']
command = "time rspec"
root_path = ENV['TM_PROJECT_DIRECTORY']

cmd = 'osascript '
cmd += '"' + ENV['TM_BUNDLE_SUPPORT'] + '/run_command.applescript"'
cmd += ' "cd ' + root_path + ' && ' + command + ' ' + ENV['TM_FILEPATH'] + '"'
cmd += ' "Ruby Tests"'
system(cmd)

The actual code is longer than this, and it is actually a Property List. Like Zach Holmam said, this is really complicated and from my perspective hampers progress.
Anyway, the end result is in my personal bundle on my dotfiles repository