Feature Request: shortcut to re-define task
amancevice opened this issue · comments
Alexander Mancevice commented
I think a nice feature would be to add a new DSL method to quickly re-define a task.
Something like:
# Define task
task :fizz do |t|
puts "Old #{t.name}"
end
# Redefine task
task! :fizz do |t|
puts "New #{t.name}"
end
# rake fizz
# => "New fizz"
Where task!
is shorthand for
Rake::Task[:fizz].clear if Rake::Task.task_defined? :fizz
Rake::Task.define_task :fizz
I'm happy to open a PR for this if that sounds like something useful to others.
konsolebox commented
There's currently a simple way:
task(:fizz).clear.enhance do |t|
puts "New #{t.name}"
end