RubyFlow The Ruby and Rails community linklog

The alias_method_chain of Rake - Override Rake Task

Rake is cool. It is built so that multiple tasks with the same name run in a reverse defined series. This is great, but sometimes you want to override a task with your own behavior and conditionally call the earlier task. Especially if that task is defined deep somewhere else, like in a rails gem.

Comments

Rake task naming, alias_method_chain and for that matter before and after hooks can be avoided simply by using inheritance or delegation.

DSL’s are cool and all but this Rake hack is an fine example of where metaskills would have been better off if Rake used less DSL and more simple OO (e.g. Thor)

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in