Note that there are some explanatory texts on larger screens.

plurals
  1. POExecuting db:test:prepare from another rake task
    text
    copied!<p>I'm trying to execute <code>rake db:test:prepare</code> from another task.</p> <pre><code>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 </code></pre> <p>Using invoke instead of execute doesn't help. It seems to work fine if I define it by itself:</p> <pre><code>task example: :environment do Rake::Task['db:test:prepare'].execute end </code></pre> <p>When I run <code>rake db:populate:development</code>, all the tasks are run except for <code>Rake::Task['db:test:prepare'].execute</code>. There's no activity in the development log for that command, but it doesn't prevent the next task from running (starting the server). Usually, I see some SQL statements when I run <code>db:test:prepare</code> by itself.</p> <p>Notes:</p> <pre><code>$ 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 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload