Read more

Fix Rubygems warning: Gem.source_index is deprecated, use Specification

Henning Koch
August 23, 2011Software engineer at makandra GmbH

Since Rubygems does not stop to change their API and still prints lots of deprecation warnings, we have a new way to disable them.

The instructions below are for legacy reasons.

After updating Rubygems you see a wall of deprecation warnings like this:

NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:197.

NOTE: Gem::SourceIndex#add_specs is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#spec_dirs= called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/rubygems_integration.rb:175

NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01
Gem::SourceIndex#refresh! called from /usr/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:34.

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/rails-2.3.11/lib/rails/gem_dependency.rb:21.

NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#search called from /usr/lib/ruby/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:119.
Illustration online protection

Rails professionals since 2007

Our laser focus on a single technology has made us a leader in this space. Need help?

  • We build a solid first version of your product
  • We train your development team
  • We rescue your project in trouble
Read more Show archive.org snapshot

Try SlimGems Show archive.org snapshot , a Rubygems fork that promises to keep the Rubygems API stable. You can install it by saying

gem install slimgems

Slimgems has worked for us for many years without problems.

If you run into any trouble, you can revert to the original Rubygems by saying

gem uninstall slimgems

#If you are using Rails 2.3.11

Rails 2.3.11 can also trigger this warning. Install 2.3.12+. After installation, you need to add rdoc to your Gemfile and change a line in your application's Rakefile: Replace require 'rake/rdoctask' with require 'rdoc/task'. See this issue Show archive.org snapshot on github.

Posted by Henning Koch to makandra dev (2011-08-23 10:15)