From: David Gaya Date: 2009-04-23T18:37:17+09:00 Subject: Re: Advice in rake Rakefile: desc 'Task that runs the build and other scripts' task :build do number_of_runs = ( ENV['RUN'] ? ENV['RUN'] : 1 ) number_of_runs.times do # Call whatever end end Then in command line: $ rake task RUN=2 2009/4/23 : > Hi, > > I'm using rake to build a project and during this build process to > call some scripts as well. > The problem is now, that the number of required script runs is unknown > to rake prior to starting rake, > but can be determined after running the script once. So I'd like to > use the output of the first runto optionally call > the task again. What is the best way doing this? > > Alternatively I could give a command line option to rake telling it > how often to run the task. I had the idea > of putting the number of runs behind the task name, like "run2", > "run1",... > This will require a dynamic detection in the rake file to separate the > actual task name "task" from the number of calls. > Is this possible? > > I tried to call the task multiple times in the command line, "rake > task task task", but this executes it only once. > > Thanks > Peter > >