lib/capitate/plugins/prompt.rb in capitate-0.2.1 vs lib/capitate/plugins/prompt.rb in capitate-0.2.2
- old
+ new
@@ -3,21 +3,24 @@
def ask(label, &block)
Capistrano::CLI.ui.ask(label, &block)
end
- def password(label, verify = false)
+ def password(label, verify = false, lazy = true)
# Lazy
- Proc.new {
+ password_prompt = Proc.new {
password = Capistrano::CLI.password_prompt(label)
if verify
- password_verify = Capistrano::CLI.password_prompt("[Verify] #{label}")
+ 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