15

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

Meltemi
  • 37,979
  • 50
  • 195
  • 293

7 Answers7

6

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.

Andy Tinkham
  • 1,329
  • 8
  • 9
  • your answer led me to mine...my problem was twofold: had a few bad gems that had to be uninstalled and reinstalled (mysql2, json & nokogiri). and also had to run your `gem pristine --all --no-extensions` back on my *global* gemset where Bundler was. Now all is well... thanks! – Meltemi May 06 '11 at 20:06
  • I have this error on rake, and I can't seem to fix it by uninstall rake and reinstall – Aaron Qian May 07 '11 at 00:50
  • Sorry - no idea. I have rake 0.8.7 installed myself, and have no problems with it, related to RubyGems or not. – Andy Tinkham May 09 '11 at 19:28
  • I was on rubygems 1.7.x and was constantly getting this error. Upgraded to 1.8.1 (gem update --system) and it cleared it up. – lambinator May 11 '11 at 20:21
  • And here I am thinking that hitting the same thing with a hammer over & over - is never useful in software... I was wrong ;-) – PandaWood Jun 23 '14 at 02:14
5

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

sudo gem update bundler
jaredonline
  • 2,912
  • 2
  • 17
  • 24
  • Updated Bundler to `1.0.13` (it was at `1.0.12` before) but warnings persist... Same deprecation warning appears before just about anything (`bundle show...`, `rake routes`, `rails s`, etc...) – Meltemi May 04 '11 at 20:38
  • Ironically the warning comes from the implementation that handles legacy versions of Gem. – tadman May 10 '11 at 17:21
  • This one worked for me... Now on bundler 1.1.0 – Artilheiro Mar 13 '12 at 04:08
1

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

dvdplm
  • 691
  • 7
  • 8
1

I updated bundler ('gem update bundler') from 1.0.12 to 1.0.15. Now all is well.

Steve Upstill
  • 432
  • 6
  • 15
0

Qoute:

As far as I see from the sources:
Simply patch rubygems_integration.rb, line 256:
- Gem.source_index.all_gems.values
+ Gem.source_index.gems.values
Reason:
Gem::SourceIndex#all_gems was just returning @gems, and now there is an attr_reader for @gems. I think that was the reason to remove the all_gems method.

Source: ruby-forum.com

Art Shayderov
  • 5,002
  • 1
  • 26
  • 33
  • Patching your gem isn't going to work very well since you'll have to patch it on each and every system affected by this. For some that could be dozens if not hundreds. – tadman May 10 '11 at 17:20
0

I deleted and reinstalled ruby 1.9.2 via RVM and then uninstalled all gems:

gem list --no-versions

Put the result in a file called gems (cut out the error messages). Then do:

GEMS=`cat gems`
for x in $GEMS ; do gem uninstall $x -aIx; done

After that I was able to run the pristine command suggested by others:

gem pristine --all --no-extensions

That's when the errors disappeared.

Sjors Provoost
  • 1,921
  • 1
  • 19
  • 34
  • 1
    If you want to do that quicker... `gem list --no-versions | xargs gem uninstall -aIx` and then run `gem pristine --all --no-extensions` – ocodo Oct 04 '11 at 04:24
0

Bundler 1.0.13 (version released May 4, 2011) running with rubygems 1.7.2 issues this annoying deprecation warning:

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/me/.rvm/gems/ruby-1.9.2-p180@composer/gems/bundler-1.0.13/lib/bundler/rubygems_integration.rb:256

A fix was committed on 5/11/2011 in the Bundler repo to correct an issue submitted 5/6/2011.

Pending release of Bundler 1.1, you can try this solution:

$ gem uninstall bundler

$ gem install bundler --version=1.0.12

I hope this helps. Took some digging to find it.

Community
  • 1
  • 1
Daniel Kehoe
  • 10,952
  • 6
  • 63
  • 82