[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

rake: passing args to Task invoke

Robert Brown

1/9/2009 3:53:00 AM

I need to write a rake task that invokes other rake tasks. Can do that
fine but cannot work out the syntax for tasks that take arguments.

For example db:migrate. How would I give it a version?

I've tried the following, but the argument is ignored:

Rake::Task['db:migrate'].invoke(:version=>'20090106012227')

Thanks in advance....
--
Posted via http://www.ruby-....

3 Answers

Roger Pack

1/10/2009 4:49:00 PM

0

> For example db:migrate. How would I give it a version?
Maybe add to ENV?
-=r

MaD

1/12/2009 12:21:00 PM

0

i didn't get that work either. did anyone have success with that?

so far, my personal workaround is to make system-calls (which is not
very nice).

MaD

1/14/2009 8:40:00 AM

0

well for db:migrate modifying ENV works very well, but if you want to
pass a certain RAILS_ENV it seems to be impossible from inside an
active rails-app. you'll have to go with system calls.

system('rake db:drop RAILS_ENV=test')

but

ENV['VERSION']= '0'
Rake::Task['db:migrate'].invoke

so far even on tha rake mailing-list no other option occurred.