Hi there, How can I run rake commands from a rake migration? I''m looking to run rake engine_migrate and others commands from a migration in order to migrate my engines along with my core app. Any advice is appreciated. Thanks, Jason
You could just include the task in the dependencies for your new task, i.e. ---RAILS_ROOT/lib/tasks/app.rake--- desc ''Migrate entire application'' task :app_migrate => [:migrate, :engine_migrate] ... I think it might actually be that simple. - james On 1/23/06, Jason Edgecombe <jedgecombe@carolina.rr.com> wrote:> Hi there, > > How can I run rake commands from a rake migration? I''m looking to run > rake engine_migrate and others commands from a migration in order to > migrate my engines along with my core app. Any advice is appreciated. > > Thanks, > Jason > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
hi, Thanks for the info. It''s not quite what I need though. I''m switching from login_generator to login_engine and I need to be able to drop the incompatible user table, then run rake engine_migrate and rake bootstrap and others to set up user_engine and login_engine. Thanks, Jason James Adam wrote:>You could just include the task in the dependencies for your new task, i.e. > >---RAILS_ROOT/lib/tasks/app.rake--- > >desc ''Migrate entire application'' >task :app_migrate => [:migrate, :engine_migrate] > > >... I think it might actually be that simple. > >- james > >On 1/23/06, Jason Edgecombe <jedgecombe@carolina.rr.com> wrote: > > >>Hi there, >> >>How can I run rake commands from a rake migration? I''m looking to run >>rake engine_migrate and others commands from a migration in order to >>migrate my engines along with my core app. Any advice is appreciated. >> >>Thanks, >>Jason >> >>
I found the answer to my own question and decided to post it. The answer is here: http://thinkingincode.blogspot.com/2005/12/adding-options-to-rake-tasks.html Rake::Task[:engine_migrate].invoke will run a rake task from within a migration and other ruby code. rake takes it''s options from ENV[]. to run "rake engine_migrate ENGINE=user" do ENV["ENGINE"]="user" Rake::Task[:engine_migrate].invoke FYI, Jason Jason Edgecombe wrote:> hi, > > Thanks for the info. It''s not quite what I need though. > > I''m switching from login_generator to login_engine and I need to be > able to drop the incompatible user table, then run rake engine_migrate > and rake bootstrap and others to set up user_engine and login_engine. > > Thanks, > Jason > > James Adam wrote: > >> You could just include the task in the dependencies for your new >> task, i.e. >> >> ---RAILS_ROOT/lib/tasks/app.rake--- >> >> desc ''Migrate entire application'' >> task :app_migrate => [:migrate, :engine_migrate] >> >> >> ... I think it might actually be that simple. >> >> - james >> >> On 1/23/06, Jason Edgecombe <jedgecombe@carolina.rr.com> wrote: >> >> >>> Hi there, >>> >>> How can I run rake commands from a rake migration? I''m looking to run >>> rake engine_migrate and others commands from a migration in order to >>> migrate my engines along with my core app. Any advice is appreciated. >>> >>> Thanks, >>> Jason >>> >>