从 Github 分支安装 Gem? [英] Install Gem from Github Branch?

查看:37
本文介绍了从 Github 分支安装 Gem?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 gemfile 中有这个:

In my gemfile I have this:

gem "authlogic", :git => "git://github.com/odorcicd/authlogic.git", :branch => "rails3"

如何将其安装为 gem 以便我可以对其进行测试?

How do I install that as a gem so I can test it?

推荐答案

您不需要在本地构建 gem.在您的 gemfile 中,您可以使用引用、分支或标签指定 github 源.

You don't need to build the gem locally. In your gemfile you can specify a github source with a ref, branch or tag.

gem 'rails', git: 'git://github.com/rails/rails.git', ref: '4aded'
gem 'rails', git: 'git://github.com/rails/rails.git', branch: '2-3-stable'
gem 'rails', git: 'git://github.com/rails/rails.git', tag: 'v2.3.5'

然后运行 ​​bundle install 或者简称为 bundle.

Then you run bundle install or the short form is just bundle.

在此处阅读更多相关信息:http://bundler.io/man/gemfile.5.html#GIT

Read more about it here: http://bundler.io/man/gemfile.5.html#GIT

更新:一个github源标识符.

gem 'country_select', github: 'stefanpenner/country_select'

然而,他们警告不要使用它:注意:在 Bundler 2.0 之前应该避免这种速记,因为它目前扩展为不安全的 git://URL.这允许中间人攻击者破坏您的系统.

However, they warn against using it: NOTE: This shorthand should be avoided until Bundler 2.0, since it currently expands to an insecure git:// URL. This allows a man-in-the-middle attacker to compromise your system.

在 Bundler 2.0 之后,您可以通过 Gemfile 顶部附近的这条语句解决上述问题:

After Bundler 2.0, you can get around the above issue with this statement near the top of the Gemfile:

git_source(:github) { |repo| "https://github.com/#{repo}.git" }

这篇关于从 Github 分支安装 Gem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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