# File lib/capistrano/task_definition.rb, line 9 9: def initialize(name, namespace, options={}, &block) 10: @name, @namespace, @options = name, namespace, options 11: @desc = @options.delete(:desc) 12: @on_error = options.delete(:on_error) 13: @max_hosts = options[:max_hosts] && options[:max_hosts].to_i 14: @body = block or raise ArgumentError, "a task requires a block" 15: @servers = nil 16: end
Returns the first sentence of the full description. If max_length is given, the result will be truncated if it is longer than max_length, and an ellipsis appended.
# File lib/capistrano/task_definition.rb, line 60 60: def brief_description(max_length=nil) 61: brief = description[/^.*?\.(?=\s|$)/] || description 62: 63: if max_length && brief.length > max_length 64: brief = brief[0,max_length-3] + "..." 65: end 66: 67: brief 68: end
Indicates whether the task wants to continue, even if a server has failed previously
# File lib/capistrano/task_definition.rb, line 72 72: def continue_on_error? 73: @on_error == :continue 74: end
Returns the description for this task, with newlines collapsed and whitespace stripped. Returns the empty string if there is no description for this task.
# File lib/capistrano/task_definition.rb, line 37 37: def description(rebuild=false) 38: @description = nil if rebuild 39: @description ||= begin 40: description = @desc || "" 41: 42: indentation = description[/\A\s+/] 43: if indentation 44: reformatted_description = "" 45: description.strip.each_line do |line| 46: line = line.chomp.sub(/^#{indentation}/, "") 47: line = line.gsub(/#{indentation}\s*/, " ") if line[/^\S/] 48: reformatted_description << line << "\n" 49: end 50: description = reformatted_description 51: end 52: 53: description.strip.gsub(/\r\n/, "\n") 54: end 55: end
Returns the task’s fully-qualified name, including the namespace
# File lib/capistrano/task_definition.rb, line 19 19: def fully_qualified_name 20: @fully_qualified_name ||= begin 21: if namespace.default_task == self 22: namespace.fully_qualified_name 23: else 24: [namespace.fully_qualified_name, name].compact.join(":") 25: end 26: end 27: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.