[Rake-devel] How to pass arguments to Rake::Task['name'].invoke ?

Dominik Mayer dominik.mayer at beagile.de
Tue Jan 13 08:26:03 EST 2009


thanks for your reply! 

sadly this only works for 
  
  ENV['VERSION'] 

but not for 

  ENV['RAILS_ENV']

so if i'm in development-environment, the following would not drop my
test-db (unfortunately it would drop my development-db):

  ENV['RAILS_ENV'] = 'test'
  Rake::Task['db:drop'].invoke

any other ideas on that?

Am Dienstag, den 13.01.2009, 10:17 -0200 schrieb Luis Lavena:
> If you check the task source code, you will see it uses ENV to find
> the parameters.
> 
> Because of that, you cannot invoke or execute the task in the way
> you're doing. Instead you should:
> 
> ENV['VERSION'] = '0'
> Rake::Task['db:migrate'].invoke
> 
> If Rails update the task to take paramenters, you could invoke it with
> the first syntax you tried.
> 
> Hope it helps,



More information about the Rake-devel mailing list