Parent

Class Index [+]

Quicksearch

Capistrano::TaskDefinition

Attributes

name[R]
namespace[R]
options[R]
body[R]
desc[R]
on_error[R]
max_hosts[R]

Public Class Methods

new(name, namespace, options={}, &block) click to toggle source
    # 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

Public Instance Methods

brief_description(max_length=nil) click to toggle source

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
continue_on_error?() click to toggle source

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
description(rebuild=false) click to toggle source

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
fully_qualified_name() click to toggle source

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
name=(value) click to toggle source
    # File lib/capistrano/task_definition.rb, line 29
29:     def name=(value)
30:       raise ArgumentError, "expected a valid task name" if !value.respond_to?(:to_sym)
31:       @name = value.to_sym
32:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.