以 nokogir
为例,最新的版本是 1.8.0
,但是执行 gem update
无法更新到最新版本。执行 gem install
就可以安装最新版本。
[5] pry(main)> Gem::SpecFetcher.fetcher.search_for_dependency Gem::Dependency.new 'nokogiri'
=> [[[#<Gem::NameTuple nokogiri, 1.7.1, ruby>, [Remote: https://gems.ruby-china.org API URI: https://gems.ruby-china.org]],
[#<Gem::NameTuple nokogiri, 1.8.0, ruby>, [Remote: https://rubygems.org/ API URI: https://api.rubygems.org/]]],
[#<Gem::PlatformMismatch:0x007f8ed9091720
@name="nokogiri",
@platforms=["x86-mswin32-60", "x86-mingw32", "x64-mingw32", "java", "x86-mswin32", "x64-mingw32", "x86-mswin32-60", "x86-mswin32", "java", "x86-mingw32"],
@version=Gem::Version.new("1.6.1")>]]
同样的接口 rubygems.org
返回的是最新版本,gems.ruby-china.org
要旧一些。