Rake: Deleting or overwriting a task?

Rails has recently (in SVN) moved to a modularized Rakefile. This causes
me some trouble as I need to change the tasks executed before
unit/functional tests are run. :test_units as well as :test_functional
depend on :clone_structure_to_test. The latter sets up the test
database as a structural copy of the development database.

Copying includes foreign key constraints present in the development
database. Unfortunately, there is no way I can order loading (and
deletion) of fixtures so that foreign key constraints are satisfied.
Therefore I grudgingly used to create the test db from a definition
file lacking these constraints.

Now, without being able to change the :clone_structure_to_test task
directly, I'm looking for a way to either remove it as a prerequisite
from the test tasks or overwrite it. So far, I've only found ways to
add prerequisites and add blocks that are processes for a task. Is
there a way to do what I need?

Michael

···

--
Michael Schuerig Face reality and stare it down
mailto:michael@schuerig.de --Jethro Tull, Silver River Turning
http://www.schuerig.de/michael/

Just looking at the rake sources, it looks like you could do:

   Task::TASKS["clone_structure_to_test"] = nil
   task :clone_structure_to_test do
     ...
   end

I haven't tried this, though...

- Jamis

···

On Sep 5, 2005, at 8:41 AM, Michael Schuerig wrote:

Rails has recently (in SVN) moved to a modularized Rakefile. This causes
me some trouble as I need to change the tasks executed before
unit/functional tests are run. :test_units as well as :test_functional
depend on :clone_structure_to_test. The latter sets up the test
database as a structural copy of the development database.

Copying includes foreign key constraints present in the development
database. Unfortunately, there is no way I can order loading (and
deletion) of fixtures so that foreign key constraints are satisfied.
Therefore I grudgingly used to create the test db from a definition
file lacking these constraints.

Now, without being able to change the :clone_structure_to_test task
directly, I'm looking for a way to either remove it as a prerequisite
from the test tasks or overwrite it. So far, I've only found ways to
add prerequisites and add blocks that are processes for a task. Is
there a way to do what I need?

Michael

--
Michael Schuerig Face reality and stare it down
mailto:michael@schuerig.de --Jethro Tull, Silver River Turning
Michael Schürig | Sentenced to making sense

Jamis Buck wrote:

Just looking at the rake sources, it looks like you could do:

   Task::TASKS["clone_structure_to_test"] = nil
   task :clone_structure_to_test do
     ...
   end

I haven't tried this, though...

Thanks! It works indeed.

Michael

···

--
Michael Schuerig Nothing is as brilliantly adaptive
mailto:michael@schuerig.de as selective stupidity.
Michael Schürig | Sentenced to making sense --A.O. Rorty, The Deceptive Self