Skip to content

Instantly share code, notes, and snippets.

@nixpulvis
Last active December 14, 2015 15:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nixpulvis/5106115 to your computer and use it in GitHub Desktop.
Save nixpulvis/5106115 to your computer and use it in GitHub Desktop.
Automatically print tasks description wrapping the execution of the task.
# Automatically print tasks description wrapping the execution of
# the task.
module Capistrano::Configuration::Namespaces
alias_method :_task, :task
def task(name, options = {}, &block)
desc = next_description
full_task_name = [fully_qualified_name, name].compact.join(':')
$column = 0
$last_was_after = true
before full_task_name do
if desc
print "\n" unless $last_was_after
$column.times { print "*".magenta + " " }
print "-->".magenta + " #{desc} "
$column += 1
$last_was_after = false
end
end
after full_task_name do
if desc
$column -= 1
$column.times { print "*".magenta + " " } if $last_was_after
puts "Done".green
$last_was_after = true
end
end
_task(name, options, &block)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment