[Rake-devel] redefine rake task broken in 0.8.x for a rails app
james.adam at gmail.com
Thu Jan 3 14:55:51 EST 2008
> Since redefine/clear_task functionally is something several people have asked for, I'm
> thinking about adding something like that to rake directly. So I'm trying to understand
> what people need out of this feature.
> Are you trying to ...
> (1) Clear existing prerequisites and actions and introduce new ones, or
> (2) Completely delete the existing task and replace it with a different task (of a possibly
> different task type)?
> If you have use cases for this, I would like to hear them.
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. In my specific case, it's really only to add a single
line of code to one of the pre-existing rake tasks (as John Dell
I can see pluses for enabling both (1) and (2) though - certainly in
some cases it'd be good to "mock out" the prerequisites of a rake task
to test only a single stage. For example:
task :process_data => :generate_data do
# do the processing
If the ":generate_data" task takes a long time and/or depends on other
inputs, it may be useful to "stub" the :generate_data task to simply
copy in some fixture data to where :process_data expects it. Then
again, perhaps such "mocking" would be done via re-implementation
(i.e. option (2)) anyway?
Sorry if that's not very clear; my real-world use case is the
situation where a plugin in Rails wishes to change the behaviour of an
existing Rake task :)
* J *
More information about the Rake-devel