Do I need to associate gems with the application?

Having received a new car, I took the opportunity to try something new. RVM is great and I use gemsets, but after reading a few blog posts, I decided to use the switch for rbenv and use the middleware to manage my gems exclusively, as described in Ruby Rogue 45 .

I don’t collaborate much, and if I do, it’s usually with one or two other people.

The supplier’s documentation indicates how to pack gems into the vendor/cache directory by running:

 $ bundle package $ bundle install --local 

Great private gems that can be checked in the original management; I believe deployment on a clean server or collaboration is easier?

However, if you check your Gemfile and Gemfile.lock in the original control, then what does the bundle package need?

Ryan McGiry advocates this approach on this blog in early 2011 and on another blog on 2010, Yehuda Katz says:

You might want to install your associated gems in another location, such as a directory in the application itself. This ensures that each application has its own copy of gemstones and provides an additional level of isolation.

This isolation is like gemsets, I suppose, and I can imagine, when you have a huge list of system stones, it would be hard to know which ones are really used by your applications.

So, pack your gems using the app?

Does anyone do this? Is this practice obsolete?

What is the best practice and what are the advantages / disadvantages of linking gemstones in the application?

+6
source share
1 answer

I think the package package has a narrow set of use cases.

Gemfile and Gemfile.lock deal with version locking, but in the end you still go to rubygems.org and download the gem when you install the package.

In three scenarios, I see the package package is useful:

1) I have a clean working environment and I don’t want to touch rubygems.org at all. This may be due to a security protocol, limited access to the Internet, etc. In the end, I have a completely standalone application package with all the selected and ready-to-use stones, without much touching the server environment or the Internet.

2) I want to download the gem, unpack it, wind it with it and use it. Especially if I don't want to do things like git, or branching, or any of these materials.

3) From the point of view of the development team, you can say that all the precious stones used must be packed and local in the application. You do not have to worry about the fact that developers install different versions, relate to their environment, etc. This reason is a little weak in my eyes, but I saw this logic once or twice.

In the end, if you do not have a precedent in which you actively hunt for this ability, I would stay away from it.

+4
source

All Articles