Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use "gets" on a rake task?

People also ask

How do I list a Rake task?

You can get a list of Rake tasks available to you, which will often depend on your current directory, by typing rake --tasks . Each task has a description, and should help you find the thing you need.

How do you define a Rake task?

Rake enables you to define a set of tasks and the dependencies between them in a file, and then have the right thing happen when you run any given task. The combination of convenience and flexibility that Rake provides has made it the standard method of job automation for Ruby projects.


The problem is that Kernel#gets (which is what you're calling if you just use gets by itself) assumes you're pulling from a file named by the arguments passed to Rake. That means gets tries to return the content of a file called [rake-task-here], which almost certainly doesn't exist.

Try STDIN.gets.