Class: Cape::Capistrano

Inherits:
Object
  • Object
show all
Defined in:
lib/cape/capistrano.rb

Overview

An abstraction of the Capistrano installation.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Capistrano) initialize(attributes = {})

Constructs a new Capistrano object with the specified attributes.



17
18
19
20
21
22
# File 'lib/cape/capistrano.rb', line 17

def initialize(attributes={})
  attributes.each do |name, value|
    send "#{name}=", value
  end
  self.rake ||= new_rake
end

Instance Attribute Details

- (Object) rake

A Cape abstraction of the Rake installation.



12
13
14
# File 'lib/cape/capistrano.rb', line 12

def rake
  @rake
end

Instance Method Details

- (Capistrano) define_rake_wrapper(task, named_arguments) {|recipes| ... }

Note:

Any parameters that the Rake task has are integrated via environment variables, since Capistrano does not support recipe parameters per se.

Defines a wrapper in Capistrano around the specified Rake task.

Options Hash (task):

  • :name (String)

    the name of the Rake task

  • :parameters (Array of String, nil)

    the names of the Rake task's parameters, if any

  • :description (String)

    documentation for the Rake task

Options Hash (named_arguments):

  • :binding (Binding)

    the Binding of your Capistrano recipes file

Yields:

  • (recipes)

    a block that customizes the Capistrano recipe(s) generated for the Rake task(s); optional

Yield Parameters:

  • recipes (RecipeDefinition)

    an interface for customizing the Capistrano recipe(s) generated for the Rake task(s)

Raises:



49
50
51
52
53
54
55
56
57
# File 'lib/cape/capistrano.rb', line 49

def define_rake_wrapper(task, named_arguments, &block)
  unless (binding = named_arguments[:binding])
    raise ::ArgumentError, ':binding named argument is required'
  end

  capistrano_context = binding.eval('self', __FILE__, __LINE__)
  describe  task, capistrano_context
  implement(task, capistrano_context, &block)
end