title: Accepting user input from the console/command prompt inside a rake task
body: <p>I'm writing a custom rake task for Rails, and there is a point the program where it summarises what it's going to do and then asks the user if what it's about to do is correct.</p>
  
  <pre><code>puts "\n Is this what you want to happen? [Y/N]"
  answer = gets.chomp
  
  if answer == "Y"
      # commits
  else if answer == "N"
      return false #(Aborts the rake task)
  end
  </code></pre>
  
  <p>However, this code causes the rake to be aborted prematurely;</p>
  
  <pre><code>rake aborted!
  No such file or directory - populate
  </code></pre>
  
  <p>"<strong>populate</strong>" is the name of the rake task.</p>
  
  <p>I think what's really causing this error in the <strong>.gets</strong> method.</p>
  
  <p>I don't know how the <strong>.gets</strong> method explicitly works, but I'm guessing it must automatically send the user input back to the file where the script is written, and for some reason it's getting confused and it thinks the name of the rake task is the name of the file. As <strong>populate.rake</strong> doesn't exist, I think this is why the error is being thrown.</p>
  
  <p>However, I don't know how I can get around this error. Does <strong>rake</strong> offer an alternate method to <strong>.gets</strong>?</p>