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:

before_install:
  - 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.

jonathan@collectiveidea.com

Comments

  1. March 07, 2015 at 8:03 AM

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