Module: Capistrano::Configuration::Execution

Defined in:
lib/capistrano/ext/params.rb

Instance Method Summary collapse

Instance Method Details

#execute_task(task) ⇒ Object



71
72
73
74
75
# File 'lib/capistrano/ext/params.rb', line 71

def execute_task(task)
  optional_params(task.options[:optional]) if task.options[:optional]
  required_params(task.options[:required]) if task.options[:required]
  original_execute_task(task)
end

#optional_params(params = []) ⇒ Object



50
51
52
53
54
# File 'lib/capistrano/ext/params.rb', line 50

def optional_params(params=[])
  params.each do |param|
    env_set_optional(param)
  end
end

#original_execute_taskObject



70
# File 'lib/capistrano/ext/params.rb', line 70

alias_method :original_execute_task, :execute_task

#required_params(params = []) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/capistrano/ext/params.rb', line 56

def required_params(params=[])
  params = [ params ].flatten

  # Query user for any undefined variables
  params.each do |param|
    param_desc = $capistrano_ext_params[param][:description] || "value for #{param}"
    unless exists?(param)
      set_ask( param, "#{param} - #{param_desc}: " )
    end

    puts "  %s: %s" % [param, fetch(param)]
  end
end