Creating a Rakefile

0 views
Skip to first unread message

John Kopanas

unread,
Nov 21, 2006, 8:54:45 AM11/21/06
to rubyonra...@googlegroups.com
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 Kopanas
jo...@kopanas.com

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

Alan C Francis

unread,
Nov 21, 2006, 9:05:49 AM11/21/06
to rubyonra...@googlegroups.com
John Kopanas 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

--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages