This is probably really simple: I want a new rake task to collect all the steps that we need to do to reset the state after changing branches. The steps needed can be done at the command line as follows:
rake db:reset ttv:seed ttv:develop # initialize the database rake db:test:load ttv:seed RAILS_ENV=test # initialize the test database rake test # run tests
So they need to be run in a certain order, and it looks like normal rake dependencies wouldn't enforce the order. So a bit of research got me this which is ugly and anyway doesn't work right. What's the right way to do it?
desc "Full Reset of DB after changing branches or installation" task :full_reset => :environment do Rake::Task['db:reset'].execute({:RAILS_ENV => "development"}) Rake::Task['ttv:seed'].execute Rake::Task['ttv:develop'].execute Rake::Task['db:test:load'].execute({:RAILS_ENV => "test"}) Rake::Task['ttv:seed'].execute({:RAILS_ENV => "test"}) end