On Nov 29, 2007 12:08 PM, Rob Lucas <roblucas / lucasandblench.com> wrote:
> Hi Thufir,
>
> I'm new to Rake as well, so I don't know if I can tell you anything much
> more than what is in the previous posts. The project I was concerned
> with here was to use Rake to do deployments of my Rails sites- moving
> and backing up the previously released version, unzipping the new one,
> setting up the mongrel server stuff etc. I needed my Rake task to stop
> and ask the user for input at various points, and that was what this
> question was about.
>
> This is an example of the solution I ended up with for asking the user
> for input :
>
> puts "\nDeploying #{new_release_name}\n\nPlease enter the name of the
> last release:\n"
> last_release_name = $stdin.gets.chomp
>
> This waits for the user to enter a name for the last release at the
> command line, then stores that string in the variable
> "last_release_name", and carries on with the task.
>
> For this to work, I needed to specify in the Rake task that "gets"
> should look to standard input - $stdin - for input from the user, as by
> default in Rake, "gets" apparently looks for input to an object with the
> name of the task itself.
>
> I originally framed the question in terms of the unix command "read",
> which does something similar to "gets" here, because I was familiar with
> this from writing shell scripts.
>
> I hope this is helpful.
>
> Rob.

You may find subversion (instead of zipping the old sources) and
capistrano (for the overall deployment) useful
- see for example
http://topfunky.com/clients/peepcode/free-episodes/peepcode-free-deprec.mov

Other than that, you can
- store the release name in some file for later use (you wouldn't have
to ask the user, just read from the file)
- provide the name on the command line
rake something LAST_RELEASE=asdfghjkl

J.