I am trying to run rake db:test:prepare from another task.
namespace :db do namespace :populate do desc "Seed development database" task development: :environment do puts "Kill local server" %x{ ps xauwww | grep -i --regex="[t]hin" | awk '{print $2}' | xargs kill } puts "Resetting development database" Rake::Task['db:reset'].execute puts "Migrating development database" Rake::Task['db:migrate'].execute puts "Populating development database" Rake::Task['db:populate'].execute puts "Pepare test database" Rake::Task['db:test:prepare'].execute puts "Start local server" system 'thin -d start' end … end
Using a call instead of executing does not help. It seems to work fine if I define it myself:
task example: :environment do Rake::Task['db:test:prepare'].execute end
When I run rake db:populate:development , all tasks are executed except for Rake::Task['db:test:prepare'].execute . There is no activity for this command in the development log, but this does not prevent the next task from starting (server start). I usually see some SQL statements when I run db:test:prepare myself.
Notes:
$ rails -v Rails 3.2.2 $ ruby -v ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0] $ uname -a Darwin hook 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64
jrhorn424
source share