Creating a Rakefile

A couple questions concerning rakefiles?

  1. Where should I store Rakefile within my rails project? Within the
    task folder? (if not then what is task folder meant for?)
  2. How do I extend the pre-existing rake tasks? For instance if I
    want to create a “rake db:populate_db” task
  3. Is active record and the models within my rails project available
    to the rake task by default? If not how do I include them?

Thanks for your help :-).

Thanks for your help.

Your Friend,

John


John K.
[email protected]

http://www.kopanas.com
http://www.cusec.net
http://www.soen.info

John K. wrote:

A couple questions concerning rakefiles?

  1. Where should I store Rakefile within my rails project? Within the
    task folder? (if not then what is task folder meant for?)
  2. How do I extend the pre-existing rake tasks? For instance if I
    want to create a “rake db:populate_db” task
  3. Is active record and the models within my rails project available
    to the rake task by default? If not how do I include them?

Hi John,

  1. Rails creates a rakefile for you in the root of your app. If you
    just type ‘rake’ from your rails app directory it runs all tests by
    default.

  2. Create .rake files in that task folder to define new tasks ( see, for
    example http://www.bigbold.com/snippets/posts/show/2925 )

  3. I would have thought not available by default, but the standard
    require mechanism would work (I assume).

On a more general note, you can already populate your db (if you’re
using ActiveRecord migrations) using the standard task “db:migrate”.

Alan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs