0

After recently integrating Travis-CI and Coveralls for a github repo, I can't get Travis to build properly. I get this error:

$ ruby --version
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
$ rvm --version
rvm 1.26.8 (latest-minor) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ bundle --version
Bundler version 1.7.6
$ gem --version
2.4.5
install.bundler
5.06s$ bundle install --jobs=3 --retry=3 --deployment
Fetching gem metadata from http://rubygems.org/..........
Installing multi_json 1.10.1
Installing docile 1.1.5
Installing simplecov-html 0.8.0
Installing tins 1.3.3
Installing thor 0.19.1
Using bundler 1.7.6
Installing rake 10.4.2
Installing simplecov 0.9.1
Installing term-ansicolor 1.3.0
Installing coveralls 0.7.8
Your bundle is complete!
It was installed into ./vendor/bundle
0.80s$ bundle exec rake
/home/travis/.rvm/rubies/ruby-2.1.5/bin/ruby test/unit_test.rb
/home/travis/build/devonparsons/ruby-tricks/vendor/bundle/ruby/2.1.0/gems/coveralls-0.7.8/lib/coveralls/api.rb:5:in `require': cannot load such file -- rest_client (LoadError)
from /home/travis/build/devonparsons/ruby-tricks/vendor/bundle/ruby/2.1.0/gems/coveralls-0.7.8/lib/coveralls/api.rb:5:in `<class:API>'
from /home/travis/build/devonparsons/ruby-tricks/vendor/bundle/ruby/2.1.0/gems/coveralls-0.7.8/lib/coveralls/api.rb:2:in `<module:Coveralls>'
from /home/travis/build/devonparsons/ruby-tricks/vendor/bundle/ruby/2.1.0/gems/coveralls-0.7.8/lib/coveralls/api.rb:1:in `<top (required)>'
from /home/travis/build/devonparsons/ruby-tricks/vendor/bundle/ruby/2.1.0/gems/coveralls-0.7.8/lib/coveralls.rb:3:in `require'
from /home/travis/build/devonparsons/ruby-tricks/vendor/bundle/ruby/2.1.0/gems/coveralls-0.7.8/lib/coveralls.rb:3:in `<top (required)>'
from test/unit_test.rb:3:in `require'
from test/unit_test.rb:3:in `<main>'
rake aborted! 

Clearly it's not installing the rest-client, but my Gemfile.lock (and after trying to fix it, my Gemfile) both specify it:

source 'http://rubygems.org'
gem 'coveralls', require: false
gem 'rest-client'
gem 'rake'

Gemfile.lock:

GEM
  remote: http://rubygems.org/
  specs:
    coveralls (0.7.8)
      multi_json (~> 1.10)
      rest-client (~> 1.7)
      simplecov (~> 0.9.1)
      term-ansicolor (~> 1.3)
      thor (~> 0.19.1)
    docile (1.1.5)
    ffi (1.9.6-x64-mingw32)
    mime-types (2.4.3)
    multi_json (1.10.1)
    netrc (0.10.2)
    rake (10.4.2)
    rest-client (1.7.2-x64-mingw32)
      ffi (~> 1.9)
      mime-types (>= 1.16, < 3.0)
      netrc (~> 0.7)
    simplecov (0.9.1)
      docile (~> 1.1.0)
      multi_json (~> 1.0)
      simplecov-html (~> 0.8.0)
    simplecov-html (0.8.0)
    term-ansicolor (1.3.0)
      tins (~> 1.0)
    thor (0.19.1)
    tins (1.3.3)

PLATFORMS
  x64-mingw32

DEPENDENCIES
  coveralls
  rake
  rest-client

The only noticeable difference between Travis's env and my own is my gem version is 2.2.2 and bundler version is 1.7.12

Something I don't understand is why Travis is passing the --deployment flag when it is supposed to be automating my test - shouldn't it be in test environment? In any case, when I bundle install --deployment on my own machine, rest-client 1.7.2 is still installed unlike on Travis.

What do I do to ensure rest-client gets installed?

Devon Parsons
  • 1,234
  • 14
  • 23

1 Answers1

1

The problem was that bundler on windows was adding platform-specific suffixes to the Gemfile.lock file, telling Travis (running on a linux system) not to bother with the gem. The solution (and this should have been the case anyway) is to git rm Gemfile.lock and add it to the .gitignore file. It is sufficient to have the Gemfile in the project.

Devon Parsons
  • 1,234
  • 14
  • 23