我正在尝试设置Travis CI,但是ruby并不按我期望的方式工作。为什么红宝石(在特拉维斯CI)找到我的宝石安装宝石?
它看起来像特拉维斯CI正确运行我的软件包安装,但红宝石宝石之后不能立即发现红宝石。这里的特拉维斯日志:
$ ruby --version
ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-darwin13.1.0]
$ rvm --version
rvm 1.25.33 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
$ bundle --version
Bundler version 1.7.4
[... snip ...]
$ bundle install --jobs=3 --retry=3 --deployment
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Installing colorize 0.7.2
Installing json 1.8.1
Using bundler 1.7.4
Installing dnssd 2.0
Your bundle is complete!
It was installed into ./vendor/bundle
$ cat Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
colorize (0.7.2)
dnssd (2.0)
json (1.8.1)
PLATFORMS
ruby
DEPENDENCIES
colorize
dnssd
json
The command "cat Gemfile.lock" exited with 0.
$ ruby -e "require 'colorize'"
/Users/travis/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- colorize (LoadError)
from /Users/travis/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
The command "ruby -e "require 'colorize'"" exited with 1.
Done. Your build exited with 1.
的.travis.yml
文件很简单,现在:
language: objective-c
script:
- cat Gemfile.lock
- bundle env
- ruby -e "require 'colorize'"
我认为我做一个简单的错误(可能是一个纯Ruby的错误),但我不能看见。我在这里做错了什么?
Bundler不会让东西神奇地可用;你需要在你的脚本中需要'bundler/setup'来让Bundler设置你的加载路径。 –
这是有道理的,但现在我想知道我的本地机器上发生了什么,使它在那里工作。难道是'gem install'与'bundle install'不同吗? – Ian
'gem install'与'bundle install'不同,是的。 –