Top Level Namespace

Defined Under Namespace

Modules: Cape

Instance Method Summary collapse

Instance Method Details

#Cape(&block) {|cape| ... } ⇒ 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

Parameters:

  • block (Proc)

    Cape and Capistrano statements

Yields:

  • (cape)

    a block containing Cape statements

Yield Parameters:

  • cape (Cape::DSL)

    the Cape DSL; optional

Returns:

  • (Cape)

    the Cape module



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

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