如何告诉Bundler使用全系统安装的gems(生产部署)? [英] How to tell Bundler to use gems installed systemwide (production deployment)?
问题描述
在Capistrano部署Rails应用程序时,我希望Bundler将gem安装到 shared / bundles
目录中,只要它无法在系统范围内找到已安装的gems。例如,如果我有一个 pg
gem v
shared / bundles
dir中构建并安装一个新的。 我使用的是Ubuntu Server,并为多个用户安装了RVM。
Bundler允许使用共享(rubygems)和出售(bundler)gem,默认情况下 bundler / capistrano
配置为:
set:bundle_flags,--deployment --quiet
只强制售卖宝石,
您可以切换回共享宝石,具体为:
set:bundle_flags,--system --quiet
仍然安装在供应商
中,但也使用共享宝石:
set:bundle_flags,--path#{shared_path} / bundles --quiet
如果已经使用 - deployment
(缺省值)运行了部署,那么它可以帮助运行一次部署:
set:bundle_flags,--no-deployment
When deploying a Rails app with Capistrano, I want Bundler to install gems to shared/bundles
dir ONLY IF it can't find gems installed systemwide already. How do I do it?
For example, if I have a pg
gem v 0.14
already installed on the system, I want Bundler to use it and not build and install a new one into shared/bundles
dir of my application.
I'm using Ubuntu Server and RVM is installed for multiple users.
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"
这篇关于如何告诉Bundler使用全系统安装的gems(生产部署)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!