Travis CI with Rails 2.3.18 and Ruby 1.9.3

If you use Travis CI and have a legacy Rails 2 app that’s running on Ruby 1.9.3, you might have encountered this error:

undefined method `source_index' for Gem:Module

The Travis CI VM for Ruby 1.9.3 runs a RubyGems version greater than 2.0. RubyGems 2.0 removes the source_index method entirely. You’ll have to downgrade to an older version to get Travis to run correctly.

This is as easy as adding this line in the before_install block in the project’s travis.yml file:

  - gem update --system 1.8.25

If you have other commands to run in the before_install block, put this line at the top to ensure the rest of the build process uses the compatible version of RubyGems.


Add a Comment

Hmm...that didn't work.

Something went wrong while adding your comment. If you don't mind, please try submitting it again.

Comment Added!

Your comment has been added to this post. Please refresh this page to view it.

Optional. If added, we will display a link to the website in your comment.
Optional. Never shared or displayed in your comment.
  1. March 07, 2015 at 8:03 AM

    The rubygems-backports implements source_index in terms of the RubyGems 2 API, alternatively.