Instead of running each rake task individually like this:
rake db:drop
rake db:create
rake db:migrate
rake db:load
I want to run one rake task that does all for.
This is what I have for my rakefile:
desc 'This rebuilds development db'
namespace :rebuild_dev do
Rake::Task["db:drop"].execute
Rake::Task["db:create"].execute
Rake::Task["db:migrate"].execute
Rake::Task["db:load"].execute
end
The above doesn't work when I run it.
You can do it with dependencies on a task with no body.
You want
invoke
notexecute
. A little excerpt from my own code showing how to pass variables:Alternatively, you can make the task depend upon another task as I have done above with
:create
depending uponclients:creation:checks
.Just to clarify, a namespace is for grouping tasks, so you must actually define the tasks within the namespace as I have above. You can't simply call tasks from within a namespace.
So your code above should be: