Posted almost 11 years ago. Visible to the public. Deprecated.

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

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:

Copy
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.

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

Copy
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

Copy
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 Archive on github.

Your development team has a full backlog of feature requests, chores and refactoring coupled with deadlines? We are familiar with that. With our "DevOps as a Service" offering, we support developer teams with infrastructure and operations expertise.

Owner of this card:

Avatar
Henning Koch
Last edit:
over 4 years ago
by Henning Koch
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Henning Koch to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more