Sha256: 15ae7f81ae3c3be8e523e9f042a1537f7d37445b65bfed374bdfb5b4c2a8c597

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

module Capitate::Plugins::Prompt
  
  def ask(label, &block)
    Capistrano::CLI.ui.ask(label, &block)
  end
  
  def password(label, verify = false, lazy = true)
    # Lazy
    password_prompt = Proc.new { 
      password = Capistrano::CLI.password_prompt(label)
    
      if verify
        password_verify = Capistrano::CLI.password_prompt("[VERIFY] #{label}")
        raise "Passwords do not match" if password != password_verify
      end
    
      password
    }
    
    return password_prompt if lazy
    password_prompt.call
  end
  
end

Capistrano.plugin :prompt, Capitate::Plugins::Prompt

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capitate-0.2.2 lib/capitate/plugins/prompt.rb
capitate-0.2.3 lib/capitate/plugins/prompt.rb