我正在嘗試設置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'不同,是的。 –