Rake: Deleting or overwriting a task?

  • Thread starter Michael Schuerig
  • Start date
M

Michael Schuerig

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
 
J

Jamis Buck

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
 
M

Michael Schuerig

Jamis said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top