4
インストールしてrake db:migrateとrake db:seedをバンドルするrakeタスクを作成する方法。rakeタスクをバンドルしてからrake db:migrateとrake db:seedのどちらに書き込むか?
namespace 'install' do
'bundle install'
'rake db:migrate'
end
インストールしてrake db:migrateとrake db:seedをバンドルするrakeタスクを作成する方法。rakeタスクをバンドルしてからrake db:migrateとrake db:seedのどちらに書き込むか?
namespace 'install' do
'bundle install'
'rake db:migrate'
end
これは動作しますが、展開にカピストラーノ/シェフの使用を検討してください:
namespace :install do
task :db_reset do
# bundle install - I do not believe attempting this in a rake file
# is recommended as one would need to ensure it is run in your application
# directory and rvm has loaded correct version of ruby/gemsets (.rvmrc required)
Rake::Task['db:migrate'].invoke
end
end
代わりに、セットアップシェルの別名は何をすることができます
bundle install && bundle exec rake db:migrate && bundle exec rake db:seed