为什么我的 Rails 应用程序找不到与其一起打包的 gem?

发布于 2024-08-13 05:51:31 字数 1826 浏览 3 评论 0 原文

我有一个使用 Cucumber 和 RSpec 的 Rails 应用程序。我们将 gems 存储在供应商/gems 下,并尝试在 CI 服务器中构建应用程序(运行测试)。

当我尝试运行测试时,出现以下错误:

Missing these required gems:
  cucumber  >= 0.3.11
  rspec-rails  >= 1.2.6

当我运行 RAILS_ENV=test rake gems 时,出现以下错误:

 - [F] activerecord-oracle-adapter
    - [R] activerecord >= 1.15.5.7843
 - [F] thoughtbot-factory_girl = 1.2.0
 - [F] cucumber >= 0.3.11
    - [ ] term-ansicolor >= 1.0.3
    - [ ] treetop >= 1.2.6
    - [ ] diff-lcs >= 1.1.2
    - [I] builder >= 2.1.2
 - [F] webrat >= 0.4.4
    - [I] nokogiri >= 1.2.0
 - [F] rspec >= 1.2.6
 - [F] rspec-rails >= 1.2.6
    - [F] rspec >= 1.2.7
    - [ ] rack >= 0.4.0
 - [F] thoughtbot-shoulda >= 2.10.2

I = Installed
F = Frozen
R = Framework (loaded before rails starts)

空白 [ ] 是否意味着 gem 丢失?

config/environments/test.rb 包含以下内容:

config.gem "cucumber",           :lib => false,          :version => ">=0.3.11" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
config.gem "webrat",             :lib => false,          :version => ">=0.4.4"  unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem "rspec",              :lib => false,          :version => ">=1.2.6"  unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem "rspec-rails",        :lib => "spec/rails",   :version => ">=1.2.6"  unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
config.gem "thoughtbot-shoulda", :lib => false,          :version => ">=2.10.2" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/shoulda'))

所以一切看起来都按顺序进行,但它仍然拒绝运行。

我错过了一些明显的东西吗?

I've got a Rails app making use of Cucumber and RSpec. We are storing the gems under vendor/gems and trying to get the app building (running tests) in a CI server.

When I try to run our tests I'm getting the following error:

Missing these required gems:
  cucumber  >= 0.3.11
  rspec-rails  >= 1.2.6

When I run RAILS_ENV=test rake gems I get the following:

 - [F] activerecord-oracle-adapter
    - [R] activerecord >= 1.15.5.7843
 - [F] thoughtbot-factory_girl = 1.2.0
 - [F] cucumber >= 0.3.11
    - [ ] term-ansicolor >= 1.0.3
    - [ ] treetop >= 1.2.6
    - [ ] diff-lcs >= 1.1.2
    - [I] builder >= 2.1.2
 - [F] webrat >= 0.4.4
    - [I] nokogiri >= 1.2.0
 - [F] rspec >= 1.2.6
 - [F] rspec-rails >= 1.2.6
    - [F] rspec >= 1.2.7
    - [ ] rack >= 0.4.0
 - [F] thoughtbot-shoulda >= 2.10.2

I = Installed
F = Frozen
R = Framework (loaded before rails starts)

Do the blank empty [ ]'s mean the gem is missing?

config/environments/test.rb contains the following:

config.gem "cucumber",           :lib => false,          :version => ">=0.3.11" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
config.gem "webrat",             :lib => false,          :version => ">=0.4.4"  unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem "rspec",              :lib => false,          :version => ">=1.2.6"  unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem "rspec-rails",        :lib => "spec/rails",   :version => ">=1.2.6"  unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
config.gem "thoughtbot-shoulda", :lib => false,          :version => ">=2.10.2" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/shoulda'))

So everything looks in order, but it still refuses to run.

Am I missing something obvious?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别理我 2024-08-20 05:51:32

看起来您的 vendor/gems 中已冻结(解压)了 cucumberrspecrspec-rails目录,但缺​​少 cucumber 和 rspec-rails 的依赖项。正如对该问题的评论所述, [] 表示缺少。

我会重新开始:

rm -rf vendor/gems/cucumber
rm -rf vendor/gems/rspec-rails
rm -rf vendor/gems/rspec

然后在本地安装 gem:

gem install rspec rspec-rails cucumber

此时您应该能够成功测试应用程序。

最后,如果需要,将其解压到您的 vendor/gems 目录中:

RAILS_ENV=test rake gems:unpack:dependencies GEM=rspec-rails
RAILS_ENV=test rake gems:unpack:dependencies GEM=cucumber

或者:

RAILS_ENV=test rake gems:unpack:dependencies

将测试环境的所有内容解压到 vendor/gems 中。这将解压您当前已在本地安装但未冻结到应用程序中的 nokogiri gem。

It looks like you have cucumber, rspec, and rspec-rails frozen (unpacked) in your vendor/gems directory but you are missing dependencies for cucumber and rspec-rails. As the comment on the question says, [] indicates that is missing.

I would start over:

rm -rf vendor/gems/cucumber
rm -rf vendor/gems/rspec-rails
rm -rf vendor/gems/rspec

Then install the gems locally:

gem install rspec rspec-rails cucumber

At this point you should be able to test the app successfully.

Finally, unpack then into your vendor/gems dir if desired:

RAILS_ENV=test rake gems:unpack:dependencies GEM=rspec-rails
RAILS_ENV=test rake gems:unpack:dependencies GEM=cucumber

or alternatively:

RAILS_ENV=test rake gems:unpack:dependencies

to just unpack everything for the test environment into vendor/gems. This would unpack the nokogiri gem you currently have installed locally but not frozen into the app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文