如何处理废弃的宝石警告(SourceIndex#all_gems)?[英] How to handle deprecated gem warning (SourceIndex#all_gems)?

本文是小编为大家收集整理的关于如何处理废弃的宝石警告(SourceIndex#all_gems)?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

在运行bundle update之后立即收到此消息:

$ bundle update
NOTE: Gem::SourceIndex#all_gems is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::SourceIndex#all_gems called from /Users/meltemi/.rvm/gems/ruby-1.9.2-p180@ppr3/gems/bundler-1.0.13/lib/bundler/rubygems_integration.rb:256
.

有人知道它的含义以及如何解决吗?

注意:这是导轨3.0.7环境

推荐答案

当我升级为RubyGems 1.8.0时,我在非轨道环境中遇到了一堆宝石的错误.无论需要使用RubyGems,我都会收到警告.围绕'网络,看来RubyGems 1.7.x似乎也是一个问题,但是我从来没有安装其中一个版本,所以我不确定.我通过运行解决了这一点:

gem pristine --all --no-extensions

我不得不运行几次 - 它一直错误地出现(但通常不在运行到同一位置).最终,它已经解决了我的大部分宝石.

有一些宝石无法正确再生其规格(JSON和续集,特别是在我的情况下),因为它们需要构建扩展名. (GEM命令输出表明它跳过了它们,尽管很容易错过所有弃用警告中的消息.)对于这些宝石,我卸载了它们,然后再次重新安装它们(以前是Bundler在RubyGems 1.5安装了它们. .x)并修复了其余警告.可能是我本来可以从最初开始的攻击计划开始,但我没有尝试.

其他推荐答案

它是从捆绑木出宝石中称为的.尝试更新Bundler,以查看是否有帮助

sudo gem update bundler

其他推荐答案

pry宝石直接使用RubyGems API,不幸的是无法通过运行gem pristine --all来固定.

i分叉了撬宝石,并使用未剥夺的API调用添加了修复程序.等待掌握,这里有叉子: https://github.com/dvdplm/pry /p>

本文地址:https://www.itbaoku.cn/post/786583.html

问题描述

Got this message today after running bundle update:

$ bundle update
NOTE: Gem::SourceIndex#all_gems is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::SourceIndex#all_gems called from /Users/meltemi/.rvm/gems/ruby-1.9.2-p180@ppr3/gems/bundler-1.0.13/lib/bundler/rubygems_integration.rb:256
.

Anyone know what it means and how to address it?

Note: This is a Rails 3.0.7 environment

推荐答案

I got the same errors for a bunch of my gems in a non-Rails environment when I upgraded to rubygems 1.8.0. I got the warnings any time rubygems is required. Looking around the 'Net, it seems like it might be a problem also with rubygems 1.7.x, but I never had one of those versions installed so I'm not sure. I fixed this by running:

gem pristine --all --no-extensions

I had to run it a few times - it kept erroring out (but usually not in the same place from run to run). Eventually it got far enough that it had addressed the majority of my gems.

There were a few gems that didn't get their specifications regenerated correctly (json and sequel, specifically in my case) because they needed to build an extension. (The gem command output indicated it was skipping them, though it was easy to miss that message amidst all the deprecation warnings.) For those gems, I uninstalled them and then reinstalled them again (they'd previously been installed by bundler in rubygems 1.5.x) and that fixed the remaining warnings. It may be that I could have started with that plan of attack originally, but I didn't try.

其他推荐答案

It was called from the Bundler gem. Try updating bundler to see if it helps

sudo gem update bundler

其他推荐答案

The Pry gem uses the rubygems API directly and can't be fixed by just running gem pristine --all unfortunately.

I forked the Pry gem and added fixes using non-deprecated API calls. Pending a merge to master, here is the fork: https://github.com/dvdplm/pry