强制RubyGems使用HTTP [英] Force RubyGems to use HTTP

查看:120
本文介绍了强制RubyGems使用HTTP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力解决这个事实,即在2.9GHz Intel Core 7 MacBook Pro上 gem install 的速度极其缓慢。



我应用了我在互联网上找到的解决方案:

  https://stackoverflow.com/questions/1887704 / gem-is-very-slow 
http://buddingrubyist.wordpress.com/2009/02/14/how-to-speed-up-gem-installs-10x/

但是他们对我没有任何影响。一些帖子包括这个( ruby​​-bundle安装/更新太慢,首先对user1189762的回答发表评论)说,从HTTPS获取时, RubyGems 会比较慢。



这是我的<$ c

  --- 
gem:--no- ri - no-rdoc
基准:false
详细信息:true
update_sources:true
来源:
- http://gems.rubyforge.org/
- http://rubygems.org/
backtrace:true
bulk_threshold:1000

我的 sources 都使用 http ,但是如果进行详细安装,我会得到:

  $ sudo gem install rack -V 
密码:
GET https://rubygems.org/latest_specs.4.8。 gz
302暂时移动
GET https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET https:/ /rubygems.org/quick/Marshal.4.8 /rack-1.5.2.gemspec.rz
302暂时移动
GET https://s3.amazonaws.com/production.s3.rubygems.org/quick/Marshal.4.8/rack-1.5。 2.gemspec.rz
OK
安装gem rack-1.5.2

所有请求正在使用 https 进行。

无论如何在 gemrc 中强制 http ?是我的瓶颈吗?

解决方案

.gemrc 它存在于你的用户目录中,但是当你使用 sudo 执行命令时,执行的所有权将被终止。



请不要使用sudo或使用

  $ sudo宝石来源

管理资源。

用法:宝石来源[选项]

 选项:
-a,--add SOURCE_URI添加源
-l,--list列表源
-r, - 删除源
-c,--clear-all删除所有源(清除缓存)
-u,--update更新源缓存

命令

  $ sudo gem sources -c 
$ sudo gem sources -a http://rubygems.org/

应更改来源名单。请注意,如果您使用的是rvm,bundler或rbenv,则很可能您不需要 sudo 安装宝石。


I've been trying to workaround the fact that gem install is extremely slow on a 2.9GHz Intel Core 7 MacBook Pro.

I applied solutions I found on the internet:

https://stackoverflow.com/questions/1887704/gem-is-very-slow
http://buddingrubyist.wordpress.com/2009/02/14/how-to-speed-up-gem-installs-10x/

However they made no difference to me. A few posts including this one (ruby - bundle install/update too slow, first comment to user1189762's answer) says that RubyGems are slower when fetching from HTTPS.

This is my .gemrc:

---
gem: --no-ri --no-rdoc
benchmark: false
verbose: true
update_sources: true
sources:
- http://gems.rubyforge.org/
- http://rubygems.org/
backtrace: true
bulk_threshold: 1000

My sources are both using http, however if doing a verbose installation I get:

$ sudo gem install rack -V
Password:
GET https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET https://rubygems.org/quick/Marshal.4.8/rack-1.5.2.gemspec.rz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/quick/Marshal.4.8/rack-1.5.2.gemspec.rz
200 OK
Installing gem rack-1.5.2

All The requests are being made with https.

Anyway to force http in gemrc? Is that my bottleneck?

解决方案

The .gemrc is not applied because it lives in your user directory but when you execute the command with sudo the ownership of the execution is halted.

Either do not use sudo or use

$ sudo gem sources 

to manage the sources.

Usage: gem sources [options]

  Options:
    -a, --add SOURCE_URI             Add source
    -l, --list                       List sources
    -r, --remove SOURCE_URI          Remove source
    -c, --clear-all                  Remove all sources (clear the cache)
    -u, --update                     Update source cache

The command

$ sudo gem sources -c
$ sudo gem sources -a http://rubygems.org/

should change the source list.

Please keep in mind that if you are using rvm, bundler or rbenv, it's likely you don't need sudo to install your gems.

这篇关于强制RubyGems使用HTTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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