Gemfile.lock在Rails中使用? [英] Gemfile.lock Use in Rails?

查看:126
本文介绍了Gemfile.lock在Rails中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Rails中Gemfile.lock的用途是什么?
我一直在寻找,但找不到满意的答案。 打包商 gem: http://gembundler.com/


THE GEMFILE.LOCK



运行bundle install时,Bundler将保留全名和



























$ Bundler在随后的所有调用中都会使用该文件捆绑安装
,这可确保您始终使用相同的确切代码,即使您的
应用程序跨机器移动也是如此。



由于依赖关系解析的方式起作用,即使看起来很小的
变化(例如,更新到Gemfile(5)中的
a gem依赖关系的释放点),也可能导致在根本上不同为了满足所有的依赖,nt gems需要

$ b 结果,你应该检查你的Gemfile.lock是否为版本控制。
如果你不这样做,那么检查你的存储库
(包括你的生产服务器)的每台机器会再次解析所有依赖关系
,这将导致不同版本的第三方代码$ b $如果Gemfile(5)中的任何Gem或其任何
依赖项已被更新,则使用b。


What is the purpose of "Gemfile.lock" in Rails? I have been searching around for but could not find a satisfactory answer.

解决方案

You should read all the documentation from the bundler gem: http://gembundler.com/

THE GEMFILE.LOCK

When you run bundle install, Bundler will persist the full names and versions of all gems that you used (including dependencies of the gems specified in the Gemfile(5)) into a file called Gemfile.lock.

Bundler uses this file in all subsequent calls to bundle install, which guarantees that you always use the same exact code, even as your application moves across machines.

Because of the way dependency resolution works, even a seemingly small change (for instance, an update to a point-release of a dependency of a gem in your Gemfile(5)) can result in radically different gems being needed to satisfy all dependencies.

As a result, you SHOULD check your Gemfile.lock into version control. If you do not, every machine that checks out your repository (including your production server) will resolve all dependencies again, which will result in different versions of third-party code being used if any of the gems in the Gemfile(5) or any of their dependencies have been updated.

这篇关于Gemfile.lock在Rails中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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