开发者

how to write a rake task to bundle install then rake db:migrate then rake db:seed?

开发者 https://www.devze.com 2023-04-04 17:30 出处:网络
How to write a rake task that will bundle install then rake db:migrate then rake db:seed. namespace \'install\' do

How to write a rake task that will bundle install then rake db:migrate then rake db:seed.

namespace 'install' do
  'bundle install'
  'rake db:migrat开发者_开发技巧e'
end


This should work but consider using Capistrano/Chef for deployment:

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

alternatively, you can setup a shell alias to do

bundle install && bundle exec rake db:migrate && bundle exec rake db:seed
0

精彩评论

暂无评论...
验证码 换一张
取 消