Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: shortcut to re-define task #355

Closed
amancevice opened this issue May 30, 2020 · 1 comment
Closed

Feature Request: shortcut to re-define task #355

amancevice opened this issue May 30, 2020 · 1 comment

Comments

@amancevice
Copy link

amancevice commented May 30, 2020

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
Copy link

There's currently a simple way:

task(:fizz).clear.enhance do |t|
  puts "New #{t.name}"
end

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

No branches or pull requests

2 participants