Search code examples
ruby-on-railsrake

Run one rake task after another completes


I'm trying to split down a rake task that i have,

What im wanting to do is after the rake task completes, It fires off another rake task.

Is this possible and if so how?


Solution

  • You can use enhance to extend one task with other:

    task :extra_behavior do
      # extra
    end
    
    Rake::Task["first:task"].enhance do
      Rake::Task[:extra_behavior].invoke
    end