44

I'm learning RoR on Ubuntu 11. Got the following message when I was trying to generate an app. Did I install something incorrectly?

$ rails generate controller Pages home contact
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/shared_helpers.rb:3.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/source.rb:162.
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#each called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/source.rb:162.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/shared_helpers.rb:84.
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Kevin H
  • 599
  • 1
  • 5
  • 10

5 Answers5

53

This worked for me: downgrade rubygems:

gem update --system 1.6.2

found this advice at: Gem.source_index is deprecated, use Specification #34

givanse
  • 14,503
  • 8
  • 51
  • 75
dsaronin
  • 687
  • 5
  • 8
  • 6
    Worked well for me, all other suggestions failed :/ – EinLama Nov 24 '11 at 18:35
  • Worked for me on Ubuntu 10.04 running a chiliproject (redmine) ruby app. `gem update bundler` failed to eliminate the error/warning – hobs Sep 09 '12 at 20:18
28

Try this:

sudo gem update bundler

This will update bundler to most recent version (currently 1.0.15). This will not generate the warning or at least in my case this was the cause of the warning.

dexter
  • 1,217
  • 9
  • 12
  • 1
    Hi dexter, I have the same problem that this post are complaining and I ran this update command and "Nothing to update" was outputted. And the error persist, do you have any other tip? Thanks in advance! – rafa.ferreira Sep 03 '11 at 11:26
  • 3
    hey @Castanho try running just gem update bundler (without the sudo). – Kevin Tsoi Oct 06 '11 at 20:36
  • 2
    yupp... `gem update bundler` (without sudo) worked for me. Thanks @KevinTsoi – Bongs Jul 27 '12 at 07:40
14

The best way to solve this is:

$ gem pristine --all --no-extensions

This will rebuild all gems (excluding those with native extensions) and update their gemspecs. If you don't have any gems with native extensions or you didn't use any custom compile flags on those gems you can also omit the --no-extensions flag. Otherwise you'll have to build them seperately.

Koraktor
  • 41,357
  • 10
  • 69
  • 99
  • Thank you Koraktor for the input :) – Kevin H May 21 '11 at 03:24
  • 2
    I tried the command (with "--no-extensions" and without "--no-extensions", but I still get the same error message. Thank you for showing that you cared by responded to the question. I went on trying more stuff after seeing your post and I was able to stumble upon a solution :) – Kevin H May 21 '11 at 03:33
  • @Kevin H, so what was the solution you stumbled upon? – davemyron May 26 '11 at 21:27
  • I wrote recorded the 'partial solution' below, which was typing "sudo gem update". When I type 'rails generate controller ...", I don't see the message any more =). However, when I ran "autotest", the message shows up. So, it was not a full solution. Sorry for the trouble :). I will keep trying and provide updates. – Kevin H May 26 '11 at 23:57
  • worked well when I used `sudo gem pristine --all --no-extensions` on Mac OS. – mcritz Sep 18 '11 at 03:58
1

I tried "sudo gem update". After that, I don't see the message "Gem.source_index is deprecated, use Specification..." anymore. Yay!

Kevin H
  • 599
  • 1
  • 5
  • 10
  • 2
    Note on 2011-05-25: I still see ""Gem.source_index is deprecated, use Specification..." when I ran "autotest". Looks like the problem is not solved yet. I will reinstall Ruby + Rails. – Kevin H May 24 '11 at 23:42
-1

rails -v = 2.2.2

ruby -v = 1.8.7

This link helps me.

or simply do

gem update --system 1.6.2
manish nautiyal
  • 2,556
  • 3
  • 27
  • 34