How to tell Bundler to use gems installed systemwide (production deployment)?

◇◆丶佛笑我妖孽 提交于 2019-12-03 21:27:39

Bundler allows using shared(rubygems) and vendored(bundler) gems, by default bundler/capistrano is configured with:

set :bundle_flags, "--deployment --quiet"

which forces vendored gems only,

you can switch back to shared gems with explicit:

set :bundle_flags, "--system --quiet"

to still install in vendor but use shared gems too:

set :bundle_flags, "--path #{shared_path}/bundles --quiet"

if the deployment was already ran with --deployment(the default) then it could help to run the deploy once with:

set :bundle_flags, "--no-deployment"

This is actually a feature of Bundler, essentially it's dependency isolation – you don't want your app depending on an outside, system gems like this. Updating the system gem could then have a impact on running applications.

If you're already using capistrano you should be using require "bundler/capistrano" in your script which will install them in shared/bundles anyway. You could look into packaging before hand as well: http://gembundler.com/v1.2/bundle_package.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!