开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜