在最近为github存储库集成了Travis-CI和工作服之后,我无法让Travis正确构建。我得到了这个错误:
$ 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! 显然它没有安装rest-client,但我的Gemfile.lock (在尝试修复它之后,我的Gemfile)都指定了它:
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-clientTravis的env和我自己的环境之间唯一明显的区别是我的gem版本是2.2.2,而bundler版本是1.7.12
我不明白的是,为什么Travis要传递--deployment标志,而它应该自动化我的测试--它不应该在测试环境中吗?在任何情况下,当我在自己的机器上使用bundle install --deployment时,rest-client 1.7.2仍然安装在Travis上。
如何确保安装了rest-client?
发布于 2015-01-30 13:26:10
问题是windows上的bundler在Gemfile.lock文件中添加了特定于平台的后缀,告诉Travis (在linux系统上运行)不要为gem而烦恼。解决方案(无论如何都应该是这种情况)是使用git rm Gemfile.lock并将其添加到.gitignore文件中。在项目中有Gemfile就足够了。
https://stackoverflow.com/questions/28229461
复制相似问题