如何告诉Bundler使用全系统安装的gems(生产部署)? [英] How to tell Bundler to use gems installed systemwide (production deployment)?

查看:129
本文介绍了如何告诉Bundler使用全系统安装的gems(生产部署)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Capistrano部署Rails应用程序时,我希望Bundler将gem安装到 shared / bundles 目录中,只要它无法在系统范围内找到已安装的gems。例如,如果我有一个 pg gem v

0.14 已经安装在系统上,我希望Bundler使用它,而不是在我的应用程序的 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_pa​​th} / 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆