Tuesday, July 26, 2011

Capistrano Using User Input

Capistrano does not accept ruby methods. Suppose I need to get user input I can't use gets.strip and it would spew Method not found error.

You can use the following method to get the user input in capistrano deploy scripts.
==============
puts "This is a critical code do you want to proceed (y/n)"
value = STDIN.gets[0..0] rescue nil
exit unless value == 'y' or value == 'Y'
===============

Capistrano is full and fast automation solution. Don't include too much of user interaction in that unless necessary.

No comments:

Post a Comment