📜 ⬆️ ⬇️

When need RVM, and when enough rbenv

In this article I will not go into details of the work of RVM and rbenv. Information on these gizmos is enough on the Internet. Here I want to try to solve the question: when should I use rbenv, and when not?

purpose


To do this, let's begin to understand for what RVM was created, and why rbenv. To do this, just look at the capabilities of both systems.

Rbenv features



')
These are all possibilities unfortunately fortunately. I want to add from myself that more is not needed.

RVM features

Since there are so many opportunities (everything can be viewed on the official website), here I will give the main ones.


On this dwell. The list will be 2 times larger due to the fact that RVM supports not only manipulations with ruby, but also with gemessets.

Why do we need gem sets?


When the bundler was not in the world, all the gems needed for the project were put in the system and mixed with the gems used by another project. As a result, we received porridge with different gems of different versions, the project used the gems of the wrong version when starting and fell, otherwise it got worse and started and did not work as we would like, or the gem was not included in the project for no apparent reason. An alternative way to solve it was of course to freeze them in vendor / , but this solution did not allow updating gems (this had to be done manually), and the project weighed several times more. With the advent of the bundler , it became possible to set the gems needed for the project anywhere (to do this, pass the --path variable to the bundle install ), and these gems will not affect the work of another project. As a result, we get what RVM does for us - the work horse for managing gemsets, but for this we don’t need RVM!
This is the answer to the main question of this post. Recently it is difficult to find a project that does not use bundler. If you use the bundler in all projects, using RVM loses meaning.

How i use rbenv


Suppose we have two projects A (rails 3, ruby ​​1.9.1) and B (rails 2, ruby ​​1.8.7), rbenv is installed in the system with these versions of ruby. My actions:


It's all. As a result, we have 2 projects with different, not intersecting, sets of gems for different versions of ruby. If we enter project A, we will automatically install ruby ​​1.9.1 in the shell. When starting the server, ruby ​​1.9.1 and a set of gems from vendor / bundle will be used.
A huge plus is that we can analyze the source code of gems without any problems and modify them if necessary. I think the plus is that the source code of all the gems will be in the project, and not somewhere there, is obvious and does not require a detailed explanation and debriefing.

Why then RVM?


Rational use of RVM is obtained only in one case: if projects do not use a bundler .

Source: https://habr.com/ru/post/137333/


All Articles