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

Unknow user · July 08, 2013 · Last by yunzifeiyu replied at July 08, 2013 · 3190 hits

在 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 等小版本可以「乐观」地升级

Unknow user #2 July 08, 2013

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

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

Unknow user #4 July 08, 2013

#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“

You need to Sign in before reply, if you don't have an account, please Sign up first.