2007-06-08
# Free to modify and redistribute with credit.
#
# If you get errors, make sure to set your PATH in ~/.bash_profile per
# http://www.macromates.com/textmate/manual/shell_commands#search_path.
# Adding /opt/local/bin (where it is for me) to avoid having to do this.
export PATH="/opt/local/bin/:$PATH"
. "${TM_SUPPORT_PATH}/lib/webpreview.sh"
html_header "CapMate" "$TM_PROJECT_DIRECTORY"
cd "$TM_PROJECT_DIRECTORY" 2> /dev/null
require_cmd cap
[ -d app/controllers ] || exit_show_html "Not in a Rails project!"
ruby -e 'class << STDERR; alias_method :old_puts, :puts; def puts(m); old_puts(m.strip); Kernel.puts; end; end; load(`which cap`.strip);' deploy | pre
html_footer
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.