Invoke rake task with arguments from another task

Karim Mtl picture Karim Mtl · Aug 6, 2015 · Viewed 11.7k times · Source

I would like to be able to pass arguments for a task that I have to call from another task

Invoking without arguments works for me like this:

Rake::Task["mytask1"].invoke

However with arguments like this it does not:

Rake::Task["mytask1[1,v18_0,20141230]"].invoke

Thanks

Answer

Rajarshi Das picture Rajarshi Das · Aug 6, 2015

you can try

Rake::Task[:my_task].invoke(1,'v18_0',20141230)

or you can do

Rake.application.invoke_task("my_task[1, 'v18_0', 20141230]")