Gemfile和Gemfile.lock间的关系

原地址

  • 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以及安装最新的版本。(在不同的机器上运行不同版本会导致测试的失败……)你不需要直接地更改Gemfile.lock.
    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.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容