Top Level Namespace

Defined Under Namespace

Modules: Cape

Instance Method Summary (collapse)

Instance Method Details

- (Cape) Cape(&block) {|cape| ... }

The method used to group Cape statements.

Examples:

Basic Cape usage

# config/deploy.rb

require 'cape'

Cape do
  mirror_rake_tasks
end

Combining Cape statements with Capistrano statements

# config/deploy.rb

require 'cape'

namespace :rake_tasks do
  # Use an argument with the Cape block, if you want to or need to.
  Cape do |cape|
    cape.mirror_rake_tasks
  end
end

Yields:

  • (cape)

    a block containing Cape statements

Yield Parameters:

  • cape (Cape::DSL)

    the Cape DSL; optional



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cape.rb', line 41

def Cape(&block)
  Cape.module_eval do
    @outer_self = block.binding.eval('self', __FILE__, __LINE__)
    begin
      if 0 < block.arity
        block.call self
      else
        module_eval(&block)
      end
    ensure
      rake.expire_cache!
    end
  end
  Cape
end