每次部署的时候都执行 bundle install 的话感觉很慢也好像没那么必要,所以能不能判断如果添加了新的 gem 才执行 bundle install?
如果可以怎么写这个 task?
deploy.rb
after :finishing, :bundle do
on roles :all do
within current_path do
info "Current is: #{current_path}"
execute "cd #{current_path}; bundle install --deployment --without development test"
execute "cd #{current_path}; bundle exec rake assets:precompile RAILS_ENV=#{fetch(:stage)}"
execute "cd #{current_path}; bundle exec rake db:migrate RAILS_ENV=#{fetch(:stage)}"
execute "cd #{current_path}; passenger-config restart-app $(pwd)"
end
end
end