language: ruby
cache: bundler
rvm:
  - 2.3.7
  - 2.4.4
  - 2.5.1
  - ruby-head
env:
  - DB=SQLITE
  - DB=POSTGRES
  - DB=MYSQL
addons:
  postgresql: "9.4"
before_install:
  # https://github.com/travis-ci/travis-ci/issues/8978
  - "travis_retry gem update --system"
  - "travis_retry gem install bundler"
gemfile:
  - gemfiles/rails42.gemfile
  - gemfiles/rails50.gemfile
  - gemfiles/rails51.gemfile
  - gemfiles/rails52.gemfile
matrix:
  include:
    - rvm: 2.3.7
      script: bundle exec rubocop --parallel
      env: DB=rubocop # make travis build display nicer
  allow_failures:
    - rvm: ruby-head
  fast_finish: true
branches:
  only:
  - master
  - /.*-stable$/
sudo: false
notifications:
  webhooks:
    urls:
    - http://buildlight.collectiveidea.com/
    on_start: always

language: ruby
cache: bundler
rvm:
  - 2.3.7
  - 2.4.4
  - 2.5.1
  - ruby-head
env:
  - DB=SQLITE
  - DB=POSTGRES
  - DB=MYSQL
addons:
  postgresql: "9.4"
before_install:
  # https://github.com/travis-ci/travis-ci/issues/8978
  - "travis_retry gem update --system"
  # Rails 4.2 has a bundler 1.x requirement
  - if [ $BUNDLE_GEMFILE = $PWD/gemfiles/rails42.gemfile ]; then
      rvm @global do gem uninstall bundler -a -x;
      travis_retry gem install -v '< 2.0.0' bundler;
    else
      travis_retry gem install bundler;
    fi
gemfile:
  - gemfiles/rails42.gemfile
  - gemfiles/rails50.gemfile
  - gemfiles/rails51.gemfile
  - gemfiles/rails52.gemfile
matrix:
  include:
    - rvm: 2.3.7
      script: bundle exec rubocop --parallel
      env: DB=rubocop # make travis build display nicer
  allow_failures:
    - rvm: ruby-head
  fast_finish: true
branches:
  only:
  - master
  - /.*-stable$/
sudo: false
notifications:
  webhooks:
    urls:
    - http://buildlight.collectiveidea.com/
    on_start: always

Install bundler 1.x for Rails 4.2 builds
Install bundler 1.x for Rails 4.2 builds

4.2's still _just_ about supported, install the older Bundler it expects
while keeping everything else on 2.x.

    Bundler could not find compatible versions for gem "bundler":
      In rails42.gemfile:
        appraisal was resolved to 2.2.0, which depends on
          bundler
        rails (~> 4.2.0) was resolved to 4.2.11, which depends on
          bundler (>= 1.3.0, < 2.0)
      Current Bundler version:
        bundler (2.0.1)

Can be reverted when 4.2's dropped.
