Module: Capitate::CapExt::Namespace

Included in:
Capistrano::Configuration::Namespaces, Capistrano::Configuration::Namespaces::Namespace
Defined in:
lib/capitate/cap_ext/namespace.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



7
8
9
10
11
12
# File 'lib/capitate/cap_ext/namespace.rb', line 7

def self.included(base) #:nodoc:
  unless base.method_defined?(:task_without_capitate)
    base.send :alias_method, :task_without_capitate, :task
    base.send :alias_method, :task, :task_with_capitate
  end
end

Instance Method Details

#task_arg(name, desc, options = {}) ⇒ Object



14
15
16
17
# File 'lib/capitate/cap_ext/namespace.rb', line 14

def task_arg(name, desc, options = {})
  @next_task_arguments ||= []
  @next_task_arguments << options.merge({ :name => name, :desc => desc })
end

#task_with_capitate(name, options = {}, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/capitate/cap_ext/namespace.rb', line 19

def task_with_capitate(name, options={}, &block)
  task_without_capitate(name, options) do
    find_task(name).setup_defaults
    block.call
  end
  task_def = find_task(name)        
  task_def.arguments = @next_task_arguments
  @next_task_arguments = nil
  task_def
end