On Tue, Jan 13, 2009 at 12:42 PM, Dominik Mayer <[email protected]> wrote: > hallo everyone! > > i already tried to find an answer to this question on google and posted > it on the ruby-mailing list, but i had no success so far in solving my > issue. > > i detail my problem is the following: > i'm using rake with RubyOnRails and want to invoke a task from inside > another task. at the moment i do this with system calls like the > following: > > > system 'rake db:migrate VERSION=0' > or > `rake db:drop RAILS_ENV=test` > > > what i try to do now is something like that (inside another rake-task): > > > Rake::Task['db:migrate'].invoke(:version => 0) # to pass VERSION=0 > or > Rake::Task['db:drop'].execute(RAILS_ENV, test) > > > nothing has worked so far. arguments get ignored or result in errors. > what's the right way to do such a thing? > > thanks in advance > dominik
Arguments are passed through environment variables. Try this: ENV['RAILS_ENV'] = "production" Rake::Task['db:migrate].invoke -- Phusion | The Computer Science Company Web: http://www.phusion.nl/ E-mail: [email protected] Chamber of commerce no: 08173483 (The Netherlands) _______________________________________________ Rake-devel mailing list [email protected] http://rubyforge.org/mailman/listinfo/rake-devel
