Ruby on Rails中的Gemfile和Gemfile.lock有什么区别 [英] What is the difference between Gemfile and Gemfile.lock in Ruby on Rails

查看:98
本文介绍了Ruby on Rails中的Gemfile和Gemfile.lock有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Ruby on Rails的初学者,并且正在使用Rails 3.0.9.

I am a beginner to Ruby on Rails and I am using Rails 3.0.9.

Rails中的GemfileGemfile.lock有什么区别?

What is the difference between Gemfile and Gemfile.lock in Rails?

推荐答案

Gemfile是您在其中指定要使用的gem的地方,并可以指定哪些版本.

The Gemfile is where you specify which gems you want to use, and lets you specify which versions.

Gemfile.lock文件是Bundler记录已安装的确切版本的位置.这样,当同一库/项目加载到另一台计算机上时,运行bundle install将查看Gemfile.lock并安装完全相同的版本,而不是仅使用Gemfile并安装最新版本. (在不同的计算机上运行不同的版本可能会导致测试失败等.)您永远不必直接编辑锁定文件.

The Gemfile.lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.lock and install the exact same versions, rather than just using the Gemfile and installing the most recent versions. (Running different versions on different machines could lead to broken tests, etc.) You shouldn't ever have to directly edit the lock file.

查看捆绑商的目的和原理,特别是将代码检入版本控制"部分

Check out Bundler's Purpose and Rationale, specifically the Checking Your Code into Version Control section.

这篇关于Ruby on Rails中的Gemfile和Gemfile.lock有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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