Rails ruby-china 的 Gemfile 配置文件中 mongoid 的写法

匿名 · 2013年07月08日 · 最后由 yunzifeiyu 回复于 2013年07月08日 · 3189 次阅读

在 ruby-china 的项目中,Gemfile 有这样一个配置:

Mongoid 辅助插件

gem "mongoid", github: 'mongoid/mongoid', ref: '11e45e5a30a45458b83db99ab6c9d9ccc337e66f'

我看 mogoid 官网中的配置是在 Gemfile 中加入 gem "mongoid", "~> 3.0.0"

而 ruby-china 的配置又是怎么回事?

前者是为了将代码版本锁定在某次的 git 提交中 后者是将版本锁定在 3.0.0 或以上的小版本,也就是 3.0.1, 3.0.2 等小版本可以「乐观」地升级

匿名 #2 2013年07月08日

#1 楼 @HungYuHei 那后面的”ref: '11e45e5a30a45458b83db99ab6c9d9ccc337e66f'“是做什么用的?如果我要这么设置的话,里面的字符串从哪得来?

这个可以去看 bundler 的文档:http://bundler.io/v1.3/gemfile.html

匿名 #4 2013年07月08日

#3 楼 @5long 多谢! Git repositories are also valid gem sources, as long as the repo contains one or more valid gems. Specify what to check out with :tag, :branch, or :ref. The default is the master branch.

ref:后面的是对应版本的 SHA,在 github 项目首页的右上角 copy SHA 得来的。 刚才取得的 latest commit”d52c33bce36a2e427634c3483128f739213798e3“

需要 登录 后方可回复, 如果你还没有账号请 注册新账号