Capistrano allows you to, among other things, deploy a Ruby on Rails app with a simple
cap deploy, abstracting away having to check out code, restart servers etc.
It’s just ten characters to write in a terminal, but I still wanted a “cap deploy” command in TextMate, so I don’t have to switch between apps. I was a bit surprised to find no one had made and shared such a command already, but I wrote one myself.
The command can be downloaded as cap deploy.tmCommand. Right-click and save, then double-click the downloaded file. It should slip into the Rails bundle.
After having written this command, I think I understand why no one had before. Assuming you want incremental output as the deployment progresses, things get a bit tricky.
The code (with save: nothing, input: none, output: show as HTML, no scope selector) is
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Capistrano buffers its output. After trying a whole lot of different things, the only thing that actually worked to get unbuffered, incremental output was the Ruby kludge above.
STDERR.puts, which the Capistrano logger uses for output, is monkey-patched to run
Kernel.puts after each piece of output.
I only started playing with Capistrano yesterday. If I find I use more of Capistrano regularly, I might write more TextMate commands, but I’ve no such plans at this time. If you need more commands, feel free to write and distribute your own with this as a starting point.