Avoiding mirrors to install a freshly released gem

独自空忆成欢 提交于 2019-12-12 12:26:02

问题


Bundler 1.3.0 has just been released (only 10 people have installed it so far), but I can only install a pre version, or a previous version.

$ gem install bundler --version 1.3.0 --verbose
HEAD http://rubygems.org/specs.4.8.gz
302 Moved Temporarily
HEAD http://production.s3.rubygems.org/specs.4.8.gz
304 Not Modified
ERROR:  Could not find a valid gem 'bundler' (= 1.3.0) in any repository
HEAD http://rubygems.org/prerelease_specs.4.8.gz
302 Moved Temporarily
HEAD http://production.s3.rubygems.org/prerelease_specs.4.8.gz
304 Not Modified
ERROR:  Possible alternatives: bundler

$ gem install bundler --version 1.3.0 --clear-sources --source http://rubygems.org --verbose
HEAD http://rubygems.org/specs.4.8.gz
302 Moved Temporarily
HEAD http://production.s3.rubygems.org/specs.4.8.gz
304 Not Modified
ERROR:  Could not find a valid gem 'bundler' (= 1.3.0) in any repository
HEAD http://rubygems.org/prerelease_specs.4.8.gz
302 Moved Temporarily
HEAD http://production.s3.rubygems.org/prerelease_specs.4.8.gz
304 Not Modified
ERROR:  Possible alternatives: bundler

$ gem install bundler --verbose
HEAD http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
HEAD http://production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
Installing gem bundler-1.2.4
/Users/agrimm/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/bundler-1.2.4/.gitignore
<snip>
/Users/agrimm/.rbenv/versions/2.0.0-p0/bin/bundle
Successfully installed bundler-1.2.4
Parsing documentation for bundler-1.2.4
Parsing sources...
100% [100/100]  lib/bundler/vlad.rb                                             
Done installing documentation for bundler (2 sec).
1 gem installed

How can I tell rubygems to look at a canonical repository, rather than an out-of-date mirror?


回答1:


I downloaded the gem file from rubygems.org, and installed it with gem install path/to/gem/file.

Somebody said that they installed it by gem install bundler --pre, but I didn't try it.




回答2:


Try this in your Gemfile:

gem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git", :branch => "1.4"

git "git://github.com/wycats/thor.git", :tag => "v0.13.4"
gem "thor"

http://gembundler.com/git.html

Or try this gem:
https://github.com/rdp/specific_install



来源:https://stackoverflow.com/questions/15061975/avoiding-mirrors-to-install-a-freshly-released-gem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!