How do I make a Rake Task run after all other tasks? (i.e. a Rake AfterBuild task)

前端 未结 7 979
感动是毒
感动是毒 2021-02-02 12:39

I\'m new to Rake and using it to build .net projects. What I\'m interested in is having a Summary task that prints out a summary of what has been done. I want this task to alw

7条回答
  •  攒了一身酷
    2021-02-02 13:20

    If anyone came here looking for how to run a task before all other tasks (eg, a special env loading task), you can still use the same enhance method, except only the first arguement:

    task :environment do
      env = (ENV['RACK_ENV'] || 'production').downcase
      # do things before other tasks
    end
    
    # run environment task before all tasks for setup
    Rake::Task.tasks.each do |t|
      next if t.name == 'environment'
      t.enhance [:environment]
    end
    

提交回复
热议问题