更改Rubygem来源的阅读顺序 [英] Changing the reading order of Rubygem sources

查看:70
本文介绍了更改Rubygem来源的阅读顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自己托管的私人宝石.一切顺利,直到有人在rubygems.org上创建了一个同名宝石.由于rubygems.org具有比我的gem服务器URL更高的优先级.我无法再安装我的gem.我试图删除rubygems源:

I have created a private gem that I have hosted myself. Everything was going well up until someone has created a gem with the same name on rubygems.org. Since rubygems.org has a highest precedence over my gem server url. I am not able to install my gem anymore. I tried to remove the rubygems source:

$ sudo gem source -r http://rubygems.org

并重新安装它,以便它出现在gem source列表中,但不起作用.

and reinstall it so it comes after in the gem source list, but it does not work.

是否可以更改gem来源的查找顺序?

Is there a way to change the lookup order of the gem source?

请注意,我不想重命名我的宝石.

Note that I don't want to rename my gem.

推荐答案

您可以尝试specific_install gem:

gem install specific_install gem specific_install -l <git-url>

gem install specific_install gem specific_install -l <git-url>

另一种方法是像这样显式声明gem服务器:

Another way is to explicitly state the gem server like so:

gem install mygem -s http://gems.example.com

gem install mygem -s http://gems.example.com

我认为最好的选择是使用Bundler.在您的Gemfile中添加:

The best option, in my opinion, is to use Bundler. In your Gemfile add:

gem 'mygem', :git => 'git://git.example.com/myrepo.git'

gem 'mygem', :git => 'git://git.example.com/myrepo.git'

这篇关于更改Rubygem来源的阅读顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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