当我使用Bundler时,我为什么要关心RVM的Gemset特性呢?

时间:2021-06-01 07:06:46

I just don't get it. I thought, Bundler was developed to resolve version conflicts between gems. So that I just have to require "bundler/setup" and everything is fine, knowing that Bundler will load the correct versions of all my gems and their dependencies. Now, RVM is great for managing multiple Rubies, I know, but why should I care about the Gemset feature? Do I miss something here? Can it make my development even easier? Maybe, some of you can give me some hints on the perfect RVM + Bundler workflow for both, development and production.

我就是不明白。我认为,Bundler是开发用来解决gems之间的版本冲突的。所以我只需要“bundler/setup”就可以了,因为我知道bundler将装载所有gems和它们的依赖项的正确版本。我知道,RVM非常适合管理多个红宝石,但我为什么要关注Gemset特性呢?我是不是漏掉了什么?它能让我的发展更容易吗?也许,你们中的一些人可以给我一些关于RVM + Bundler开发和生产工作流程的建议。

I also don't know when RVM starts switching to another Ruby. I know that I can have an .rvmrc file in my project, but do I have to cd to this directory so that the switch happens?

我也不知道RVM何时开始切换到另一个Ruby。我知道在我的项目中可以有一个.rvmrc文件,但是我是否必须将cd到这个目录,以便进行切换?

Furthermore, I usually use Passenger for development since, thanks to the Passenger.prefpane, integration in Mac OS is great. Can I still do that with RVM or is there a better way to do it? Does Passenger recognize .rvmrc files and switch to the correct Gemset?

此外,由于乘客的原因,我通常使用乘客进行开发。预制面板,集成在Mac OS是很好的。我还可以用RVM来做吗?还是有更好的方法?乘客是否识别。rvmrc文件并切换到正确的Gemset?

3 个解决方案

#1


22  

Why should I care about RVM's Gemset feature when I use Bundler?

当我使用Bundler时,我为什么要关心RVM的Gemset特性呢?

You shouldn't.

你不应该。

Well, if you want to, you can care about, of course, so I should better say "You don't need to."

如果你想,你可以关心,当然,我应该说"你不需要"

I just listened to a podcast interview with one of the Bundler core team members who basically said that since he started using Bundler he stopped using Gemsets, because they are redundant.

我刚刚听了一个播客采访Bundler核心团队的成员他说自从他开始使用Bundler他就不再使用Gemsets了,因为它们是多余的。

Here's a blog post that discusses the same issue, with some examples.

下面是一篇讨论同样问题的博客文章,其中有一些例子。

#2


6  

When I am dealing with legacy code or forking other non-rails ruby projects that haven't for whatever reasons gone the bundle route, gemsets are such an awesome thing to have. I also find gemsets invaluable while developing gems. Nice to have multiple test environments to switch between and test the freshly built gem.

当我处理遗留代码或其他非rails的ruby项目时,无论出于什么原因,这些项目都不会按照bundle路线进行,gemsets都是非常棒的东西。我也发现宝石在开发宝石时是无价的。很高兴有多个测试环境在新构建的gem之间进行切换和测试。

Passenger doesn't read the .rvmrc to the best of my knowledge. You can't run different projects in passenger under different rubies to the best of my knowledge. My default rails setup has just bundler and rake in the global gemset. I let bundler take over from there and manage rest of the gems project wise just like you describe. Works pretty well.

据我所知,乘客没有读过。rvmrc。就我所知,你不可能在不同的红宝石下运行不同的项目。我的默认rails设置中只有bundler和rake全局gemset。我让邦德勒从那里接手,并像你描述的那样,管理其他的宝石项目。工作得很好。

#3


1  

You should definitely use gemsets if you anticipate ever having to change your bundler version. And you can use gemsets to manage gems that don't matter specifically to your Rails app (wirble etc.).

如果您预期要更改bundler版本,那么一定要使用gemsets。而且,您可以使用gemset来管理那些与Rails应用程序无关的gem (wirble等)。

#1


22  

Why should I care about RVM's Gemset feature when I use Bundler?

当我使用Bundler时,我为什么要关心RVM的Gemset特性呢?

You shouldn't.

你不应该。

Well, if you want to, you can care about, of course, so I should better say "You don't need to."

如果你想,你可以关心,当然,我应该说"你不需要"

I just listened to a podcast interview with one of the Bundler core team members who basically said that since he started using Bundler he stopped using Gemsets, because they are redundant.

我刚刚听了一个播客采访Bundler核心团队的成员他说自从他开始使用Bundler他就不再使用Gemsets了,因为它们是多余的。

Here's a blog post that discusses the same issue, with some examples.

下面是一篇讨论同样问题的博客文章,其中有一些例子。

#2


6  

When I am dealing with legacy code or forking other non-rails ruby projects that haven't for whatever reasons gone the bundle route, gemsets are such an awesome thing to have. I also find gemsets invaluable while developing gems. Nice to have multiple test environments to switch between and test the freshly built gem.

当我处理遗留代码或其他非rails的ruby项目时,无论出于什么原因,这些项目都不会按照bundle路线进行,gemsets都是非常棒的东西。我也发现宝石在开发宝石时是无价的。很高兴有多个测试环境在新构建的gem之间进行切换和测试。

Passenger doesn't read the .rvmrc to the best of my knowledge. You can't run different projects in passenger under different rubies to the best of my knowledge. My default rails setup has just bundler and rake in the global gemset. I let bundler take over from there and manage rest of the gems project wise just like you describe. Works pretty well.

据我所知,乘客没有读过。rvmrc。就我所知,你不可能在不同的红宝石下运行不同的项目。我的默认rails设置中只有bundler和rake全局gemset。我让邦德勒从那里接手,并像你描述的那样,管理其他的宝石项目。工作得很好。

#3


1  

You should definitely use gemsets if you anticipate ever having to change your bundler version. And you can use gemsets to manage gems that don't matter specifically to your Rails app (wirble etc.).

如果您预期要更改bundler版本,那么一定要使用gemsets。而且,您可以使用gemset来管理那些与Rails应用程序无关的gem (wirble等)。