One task with multiple "ask()" not triggering it more then once
task :confirmation do
if fetch(:stage) == :production then
puts <<-WARN
========================================================================
WARNING: You're about to perform actions on production server(s)
Please confirm that all your intentions are kind and friendly
========================================================================
WARN
ask(:answer, ' Are you sure you want to continue? (Y) ')
if fetch(:answer) == 'Y' then
set :confirmed, true
end
unless fetch(:confirmed)
puts "\nDeploy cancelled!"
exit
end
end
if fetch(:stage) != :test then
puts <<-WARN
========================================================================
GATEWAY: You're about to perform actions on a server(s)
that need you to provide gateway credentials.
========================================================================
WARN
gateway_username = ''
gateway_password = ''
ask(gateway_username, ' Username: ')
ask(gateway_password, ' Password: ')
end
end
before :starting, :confirmation
I want to ask the user for gateway credentials (username and password) but also warn about entering a task sequence to a production environment.
But only the first "ask()" is triggered, no question about username or password is asked the user.