It\'s not possible to invoke
the same rake task from within a loop more than once. But, I want to be able to call rake first
and loop through an array
The execute
function asks for a Rake::TaskArguments as a parameter, this is why it only accepts one argument.
You could use
stuff_args = {:match => "HELLO", :freq => '100' }
Rake::Task["stuff:sample"].execute(Rake::TaskArguments.new(stuff_args.keys, stuff_args.values))
However there is another difference between invoke and execute, execute doesn't run the :prerequisite_task when invoke does this first, so invoke and reenable or execute doesn't have exactly the same meaning.