【问题标题】:"bundle exec rake" fails to find rake in bundle“bundle exec rake”无法在 bundle 中找到 rake
【发布时间】:2014-07-02 21:28:53
【问题描述】:

我想在命令提示符下运行一个文件。我可以直接这样做,也可以从 irb 这样做,但是当我尝试通过 Cucumber 运行完全相同的文件时,它在 gemfile 中找不到 rake。

我的 Cuke 是这样开始的:

Scenario: The aliens have landed
    Given everything is set up right
    ...

匹配的步骤定义调用命令提示符并执行文件。

Given /^everything is set up right$/ do
  system('C:\svn\browser\apps\xyzstuff\lib\proof_of_concept.bat')
end

这是 proof_of_concept.bat 的内容

set curr_dir=%cd%
chdir /D C:\svn\browser\spec\integration\xyz\forms
bundle exec rake spec:integration:xyz:forms:single_order_flow MY_ENV=vdev
chdir /D %curr_dir%

这是我在运行 Cuke 时在控制台中看到的内容:

C:\svn\browser\spec\integration\xyz\forms>bundle exec rake spec:integration:xyz:forms:single_order_flow MY_ENV=vdev
C:/bundler-ruby/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:143:in `gem': rake is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
        from C:/bundler-ruby/lib/ruby/gems/1.8/bin/rake:18

我认为,当前工作目录在每种情况下都是相同的,因为它是由批处理文件控制的。为什么bundler在这种情况下没有找到rake,但是当直接或通过irb执行同一个文件时它确实找到了它?

【问题讨论】:

    标签: gem rake bundler


    【解决方案1】:

    我通过将gem 'rake', '0.8.7' 添加到C:\svn\browser\Gemfile 解决了这个问题

    这样做后,我不再遇到上述问题。但是,我确实遇到了this SO question. 中描述的问题

    【讨论】:

      猜你喜欢
      • 2013-09-29
      • 1970-01-01
      • 2014-06-22
      • 2012-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-11
      • 2012-05-28
      相关资源
      最近更新 更多