Perform rake tasks sequentially

I have rake tasks that I want to run in the correct sequence.

I want to run one rake command, which runs the other rake commands in the correct sequence.

How can i do this?

+3
source share
1 answer

you should consider defining dependencies between your tasks, such as

  task :primary => [:secondary]

  task :secondary do
    puts "Doing Secondary Task" 
  end

But if you really need to name tasks directly, you can use invoketo call another task

  task :primary do
    Rake::Task[:secondary].invoke
  end

  task :secondary do
    puts "Doing Secondary Task" 
  end

see also here

+4
source

Source: https://habr.com/ru/post/1757666/


All Articles