Rake: Deleting or overwriting a task?

Discussion in 'Ruby' started by Michael Schuerig, Sep 5, 2005.

  1. 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: --Jethro Tull, Silver River Turning
    http://www.schuerig.de/michael/
     
    Michael Schuerig, Sep 5, 2005
    #1
    1. Advertising

  2. Michael Schuerig

    Jamis Buck Guest

    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: --Jethro Tull, Silver River Turning
    > http://www.schuerig.de/michael/
    >
    >
    >
     
    Jamis Buck, Sep 5, 2005
    #2
    1. Advertising

  3. 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: as selective stupidity.
    http://www.schuerig.de/michael/ --A.O. Rorty, The Deceptive Self
     
    Michael Schuerig, Sep 5, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joe Van Dyk
    Replies:
    2
    Views:
    118
    Damphyr
    Jan 31, 2006
  2. peppermonkey
    Replies:
    1
    Views:
    270
    Gregory Brown
    Feb 10, 2007
  3. Stéphane Wirtel
    Replies:
    3
    Views:
    417
    Stephane Wirtel
    Jun 15, 2007
  4. Adam Anderson
    Replies:
    1
    Views:
    149
    Adam Anderson
    Sep 19, 2007
  5. James Mead
    Replies:
    0
    Views:
    161
    James Mead
    Jan 15, 2008
Loading...

Share This Page