Get input in Rake Tasks

This won’t work:

cvs_username = gets

to get it working you have to ask input from STDIN:

cvs_username = STDIN.gets

And this is a helper method:

def ask message
print message
STDIN.gets.chomp
end
# ...
cvs_username = ask('Please insert your CVS username')

Published in: on November 7, 2008 at 2:47 pm Comments (1)

The URI to TrackBack this entry is: http://elia.wordpress.com/2008/11/07/get-input-in-rake-tasks/trackback/

RSS feed for comments on this post.

One Comment Leave a comment.

  1. works like a charm.


Leave a Comment