[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Running a script from a rake task?

Sean Hussey

2/15/2006 7:53:00 PM

Hi everyone,

I have 2 scripts (dbload.rb and import_people.rb) that I want to
include in a rake task. How can I run an external script in a rake
task? Do I have to shell out to do it? Or should I just make those
scripts rake tasks? For this dev environment, that might not be a bad
thing.

task :cleandb => [:db_schema_import] do
# Run script/dbload.rb
# Run script/import_people.rb
end

This is in a Rails environment, but I don't think it's a Rails
specific question, so I'm posting here.

Thank you!

Sean


2 Answers

James Gray

2/15/2006 8:10:00 PM

0

On Feb 15, 2006, at 1:53 PM, Sean Hussey wrote:

> Do I have to shell out to do it?

Try this:

> task :cleandb => [:db_schema_import] do
> # Run script/dbload.rb

ruby "script/dbload.rb"

> # Run script/import_people.rb

ruby "script/import_people.rb"

> end

Hope that helps.

James Edward Gray II


Sean Hussey

2/15/2006 8:28:00 PM

0

Good lord, it's that easy? Silly me.

Thank you!

Sean

On 2/15/06, James Edward Gray II <james@grayproductions.net> wrote:
> On Feb 15, 2006, at 1:53 PM, Sean Hussey wrote:
>
> > Do I have to shell out to do it?
>
> Try this:
>
> > task :cleandb => [:db_schema_import] do
> > # Run script/dbload.rb
>
> ruby "script/dbload.rb"
>
> > # Run script/import_people.rb
>
> ruby "script/import_people.rb"
>
> > end
>
> Hope that helps.
>
> James Edward Gray II
>
>