为什么我需要bundle exec来要求这个rubygem?
我有一个Rails应用程序,在“lib/services”下有一些与Rails无关的文件。其中一个文件使用 我在为什么我需要bundle exec来要求这个rubygem?,ruby,rubygems,bundler,Ruby,Rubygems,Bundler,我有一个Rails应用程序,在“lib/services”下有一些与Rails无关的文件。其中一个文件使用 我在spec/lib下有一个空的spec文件 require "services/suggestion_parser" describe SuggestionParser do end 不幸的是,当我尝试在没有bundle exec的情况下运行该规范时,我遇到了一个错误: $: rspec spec/lib/services/suggestion_parser_spec.rb -&g
spec/lib
下有一个空的spec文件
require "services/suggestion_parser"
describe SuggestionParser do
end
不幸的是,当我尝试在没有bundle exec
的情况下运行该规范时,我遇到了一个错误:
$: rspec spec/lib/services/suggestion_parser_spec.rb
-> /Users/davidtuite/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': cannot load such file -- domainatrix (LoadError)
我的项目中的每个其他规范和gem都将在不使用bundle exec
的情况下运行。为什么我需要给这个加前缀才能让它运行
为了方便起见,这里有一个.我猜domainatrix是使用Gemfile中的
:path
或:git
选项声明的,这两个选项都不能以rubygems可以访问的方式安装gem
如果您从GEM文件中发布domainatrix的行,则可以确认这一点。尝试运行以下命令:
$ rvm get head && rvm reload
$ chmod +x $rvm_path/hooks/after_cd_bundler
$ bundle install --without production --binstubs=./bundler_stubs
这不会解决gem的具体问题,但是如果您使用rvm,那么每次运行测试时就不必输入
bundle exec
。是的,我正在从Github中提取它,所以这可能就是问题所在。我只是不知道该怎么办,因为我需要使用一个特定的fork,而原始的gem似乎没有维护。你能详细解释一下为什么:path
和:git
选项使rubygems无法访问gem吗?我很好奇这是不是可以修补的
$ rvm get head && rvm reload
$ chmod +x $rvm_path/hooks/after_cd_bundler
$ bundle install --without production --binstubs=./bundler_stubs