[Rake-devel] redefine rake task broken in 0.8.x for a rails app

James Adam james.adam at gmail.com
Thu Jan 3 18:00:14 EST 2008

On Jan 3, 2008 10:26 PM, Jim Weirich <jim.weirich at gmail.com> wrote:
> On Jan 3, 2008, at 2:55 PM, James Adam wrote:
> > I think the engines plugin is looking for option (2), where it's the
> > "body" of the rake task that needs to change, rather than any of the
> > prerequisites.
> Actually, that counts as clearing/replacing one of the actions, which
> falls under option (1).

I'll defer to your (clearly better) understanding of Rake :)

> The problem I have with the whole "clear out the task" idea is that
> it doesn't play well with multiple plugins.

Certainly; but that's a problem for Rails (or rather, Rails
developers) to solve, if indeed it really is a problem.

I'd say this shares more in common with reopening classes - certainly
any number of files might reopen a class and redefine a method,
obliterating what was there before, but it still qualifies as a
"feature" :)

If the "task => method" analogy holds, might it be possible to define
an alias to the current implementation of a task, and then redefine it
to call the aliased task along with any custom behaviour? Maybe
something like this:

alias_task :new_task_name, :original_task

redefine_task :original_task do

... perhaps something like that? It may be that this is simply not
practical, in which case I think that it's still fine to simply lose
the previous implementation - that feels Rubyish to me.

* J *

More information about the Rake-devel mailing list