# Rake task dependency question

**URL:** <https://www.ruby-forum.com/t/rake-task-dependency-question/186943>\
**Category:** Rails\
**Created:** [April 14, 2010, 5:37pm UTC](https://www.ruby-forum.com/t/rake-task-dependency-question/186943 "2010-04-14T17:37:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pitosalas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a4c791/32.png) [@pitosalas](https://www.ruby-forum.com/u/pitosalas)\
**Post date:** [April 14, 2010, 5:37pm UTC](https://www.ruby-forum.com/t/rake-task-dependency-question/186943/1 "2010-04-14T17:37:14Z")

</div>

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
