Skip to content

Conversation

@philihp
Copy link

@philihp philihp commented Apr 19, 2018

In situations where a before or after block is run on multiple tasks, it can be helpful to know which task is actually about to run. For example, I want something to run before any task:

before *Rake.application.top_level_tasks do |t|
  puts "Excuse me, I am about to run #{t}..."
end
after *Rake.application.top_level_tasks do |t|
  puts "...Thank you for letting me run #{t}"
end

This mimics how you can get the current task from within a task

task :sometask do |t|
  puts "I am running #{t}"
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant