Back

rails 部署时Gemfile 相关的内容( Gemfiles related stuff when deploying Rails app to production)

发布时间: 2014-08-03 02:29:00

1. 最好指定好具体的版本, .e.g:  (give the explicit version ) 

source 'http://ruby.taobao.org'

gem 'rails', '4.0.0'
gem 'uglifier', '2.4.0'
gem 'coffee-rails', '4.0.1'

2. $ bundle package --all

3. 在 config/deploy.rb 中,执行 bundle install --local --without=test , e.g.

  task :db_migrate do
    run "cd #{release_path} && bundle install --local"
    run "cd #{release_path} && bundle exec rake db:migrate RAILS_ENV=production"
  end 

Back