Different Gemfiles For Ruby 1.8 and 1.9 on Travis CI

{{{
I ran into a problem recently, one of my gems is using Mongoid in tests and all at sudden, Mongoid 3.0 wouldn’t support Ruby 1.8.7 anymore. My builds on Travis broke since I test my gem against 1.8.7 and 1.9.3. So, what I needed was to tell the 1.8 test to use a different Gemfile. Here’s what I did.

I configured “the matrix”:http://about.travis-ci.org/docs/user/build-configuration/ in my @.travis.yml@ file according to the manual.

matrix:
  include:
    - rvm: 1.8.7
      gemfile: gemfiles/Gemfile.mongoid-2.4
    - rvm: 1.9.3
      gemfile: Gemfile

The @Gemfile@ for 1.9.3 is straight-forward.

source :rubygems

gemspec

The modified @gemfiles/Gemfile.mongoid-2.4@ requires the older mongoid version.

source :rubygems

gemspec :path => '../'

gem 'mongoid', '~> 2.4.0'

Now, my tests run with both Ruby versions both using their own @Gemfile@. Awesome, Travis!

}}}

Advertisement

One thought on “Different Gemfiles For Ruby 1.8 and 1.9 on Travis CI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s