Ruby Flare

Your awesome Tagline

8 notes

Descriptions for capistrano tasks

To see the list of available capistrano tasks, use:

cap -T

This only shows tasks which have a description. To see the full list of all available capistrano tasks whether or not they have a description, use:

cap -vT

To get further information about a task, use:

cap -e task_name

To add a description for a task, use desc above your task block:

desc 'Start god if it is not already running'
task :start, :roles => :app do    
  run "sudo /etc/init.d/god status || (sudo /etc/init.d/god start && sleep 8)"
end

If you have more than one sentence in the desc, cap -T will only list the first sentence. cap -e will show the whole description. You can either write your description on one line or split it over several like the following:

namespace :git do
  desc <<-DESC
    Performs a git log -1 on the app servers. This is useful for \
    determining where in the git tree a server is currently at.
  DESC
  task :log, :roles => :app do
    puts "The current release is: #{current_release.split('/').last}"
    run "echo && cd #{current_path} && git log -1 | cat && echo"
  end
end

(Source: github.com)

Filed under capistrano

  1. haru012 reblogged this from rubyflare
  2. rubyflare posted this