简体   繁体   English

使rvm gemset镜像/参考Capistrano的捆绑包安装

[英]Make rvm gemset mirror/reference Capistrano's bundle install

I'm currently deploying from my local machine to a development server using Capistrano. 我目前正在使用Capistrano从本地计算机部署到开发服务器。 The dev server has a gemset for my project called 'vcc', but as is clear across the internet, Capistrano does its bundle install into shared/bundle rather than the rvm gemset. 开发服务器为我的项目提供了一个名为“ vcc”的gemset,但是在互联网上很明显,Capistrano会将其捆绑包安装到共享/捆绑包中,而不是安装到rvm gemset中。

It's easy enough to make a .rvmrc file and have that selecting the 'vcc' gemset when I cd into the project. 制作.rvmrc文件并在我进入该项目时选择'vcc'gemset很容易。 However, this gemset doesn't get updated as part of a deploy. 但是,此gemset不会作为部署的一部分进行更新。 So I still generally run all my commands with 'bundle exec', which selects the 'shared/bundle' rather than the rvm gemset. 因此,我通常仍然使用'bundle exec'运行所有命令,该命令选择'shared / bundle'而不是rvm gemset。

What I want to do is have the rvm gemset remain updated so that when I cd into the project I don't have to run bundle exec before everything. 我想做的是让rvm gemset保持更新,这样当我进入项目时,我不必在一切之前运行bundle exec。 I'm not sure what the best way to do this is. 我不确定执行此操作的最佳方法是什么。 My only idea was to create a symlink in the 'vcc' gemset directory that points to the 'shared/bundle' directory. 我唯一的想法是在'vcc'gemset目录中创建一个指向'shared / bundle'目录的符号链接。 I read somehwere that rvm should be self contained though and will not follow symlinks out of the /rvm directory? 我读到一些内容,但rvm应该是自包含的,并且不会跟随符号链接离开/ rvm目录?

I've seen that it's possible to make Capistrano deploy to your gemset, but it's not recommended. 我已经看到可以将Capistrano部署到您的gemset,但是不建议这样做。 I'm fine with letting Capistrano handle gems and rvm handle ruby, I just want to get rid of "bundle exec." 我可以让Capistrano处理宝石,而rvm处理红宝石,但我只是想摆脱“捆绑执行程序”。 Maybe there's an easier way that doesn't have anything to do with configuring Capistrano or rvm? 也许有一种更简单的方法与配置Capistrano或rvm没有任何关系?

Actually it is not recommended to use vendored gems, there are few issues with it and you will be safer using a gemset instead. 实际上,不建议使用供应商提供的gem,它存在的问题很少,因此使用gemset会更安全。

rvm-capistrano already suggests you disable the vendored gems here https://github.com/wayneeseguin/rvm-capistrano#disabling-bundle---deployment-when-using-gemsets : rvm-capistrano已经建议您在此处禁用供应的gems https://github.com/wayneeseguin/rvm-capistrano#disabling-bundle---deployment-when-using-gemsets

set :bundle_dir, ''
set :bundle_flags, '--system --quiet'

This way gems will be installed in gemset and everything will work fine. 这样,宝石将被安装在宝石集中,并且一切都会正常运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM