我正在使用 chruby 来管理我的 Ruby 版本,并使用 Bundler 的 binstubs 来避免输入“bundle exec”。我遇到了我不完全理解的问题。当我尝试在我们的 (Rails 4, Ruby 2.2.2) 应用程序中运行测试套件时,我得到了以下结果:
$ rspec
/Users/duncanmalashock/.rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- simplecov (LoadError)
from /Users/duncanmalashock/.rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/duncanmalashock/ruby_projects/platform/spec/spec_helper.rb:3:in `<top (required)>'
from /Users/duncanmalashock/.rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/duncanmalashock/.rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/duncanmalashock/ruby_projects/platform/spec/controllers/admin/admin_controller_spec.rb:1:in `<top (required)>'
from /Users/duncanmalashock/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in `load'
from /Users/duncanmalashock/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in `block in load_spec_files'
from /Users/duncanmalashock/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in `each'
from /Users/duncanmalashock/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in `load_spec_files'
from /Users/duncanmalashock/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:102:in `setup'
from /Users/duncanmalashock/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:88:in `run'
from /Users/duncanmalashock/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in `run'
from /Users/duncanmalashock/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in `invoke'
from /Users/duncanmalashock/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/exe/rspec:4:in `<top (required)>'
from /Users/duncanmalashock/.gem/ruby/2.2.2/bin/rspec:23:in `load'
from /Users/duncanmalashock/.gem/ruby/2.2.2/bin/rspec:23:in `<main>'
当我运行$ bundle exec rspec
时,套件运行正确。我一直在研究后现代的gem_home并安装了它,但它并没有给我我正在寻找的结果。我在 OSX Yosemite 上使用 zsh。
在 .zshrc 中:
source /usr/local/share/chruby/chruby.sh
source '/usr/local/share/chruby/auto.sh'
source /usr/local/share/gem_home/gem_home.sh
export PATH=./.bundle/bin:$PATH
alias b='bundle install --path .bundle/gems --binstubs .bundle/bin'