jruby 上的 Cucumber-rails 使用捆绑器将 gem 安装到我的应用程序根目录中
刚刚在 OSX 上安装了 cucumber 0.7.2
和 cucumber-rails 0.3.1
以及 jruby-1.4.0。当我运行捆绑安装时,它会在我的主应用程序中放置一个 cucumber-rails 目录,其中包含所有 gem 代码/依赖项。
首先,这绝对不是我想要的,我不确定为什么这种情况只发生在黄瓜导轨上。
其次,如果我删除此文件夹并仅手动安装 cucumber-rails,当我运行 script/generate feature blah 时,我会得到
/Users/bradrobertson/.rvm/rubies/jruby-1.4.0/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:344:in `refresh!': source index not created from disk (RuntimeError)
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/rails/vendor_gem_source_index.rb:34:in `refresh!'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/rails/vendor_gem_source_index.rb:29:in `initialize'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/rails/gem_dependency.rb:21:in `new'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/initializer.rb:298:in `add_gem_load_paths'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/initializer.rb:132:in `process'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from /Users/bradrobertson/Repos/app/source/trunk/config/environment.rb:13
from /Users/bradrobertson/Repos/app/source/trunk/config/environment.rb:1:in `require'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/commands/generate.rb:1
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/commands/generate.rb:3:in `require'
from script/generate:3
同样的运行 rake cucumber ,
rake aborted!
source index not created from disk
所以显然有些东西不会不工作。如果我重新添加 cucumber-rails 目录,那么我的 rake cucumber 就会实际运行。
有人能告诉我为什么需要在我的 Rails 应用程序中安装 gem 吗?我以前从未见过这个。
设置
jruby-1.4.0
黄瓜-0.7.2
黄瓜导轨 0.3.1
捆绑器 0.9.23
webrat 0.7.1
编辑
要添加到这一点,我决定我厌倦了尝试让它工作,所以我从我的 Gemfile 中删除了所有黄瓜/黄瓜轨道 deps 并重新运行 bundle install< /代码>。它仍然创建 cucumber-rails 目录,此外,除非该目录存在,否则我无法运行任何内容(rake 等...),否则我会收到
source index not create from disk
消息。
编辑2 我刚刚注意到我的 Rails.root/.bundle/config
有 BUNDLE_PATH: cucumber-rails
。有谁知道为什么会出现这种情况?
Just installed cucumber 0.7.2
and cucumber-rails 0.3.1
with jruby-1.4.0 on OSX. When I run a bundle install, it places a cucumber-rails directory in my main app with all of the gem code/dependencies.
First off, this is definitely not what I want and I'm not sure why this happens for cucumber-rails only.
Second, if I delete this folder and just manually install cucumber-rails, when I run script/generate feature blah
I get
/Users/bradrobertson/.rvm/rubies/jruby-1.4.0/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:344:in `refresh!': source index not created from disk (RuntimeError)
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/rails/vendor_gem_source_index.rb:34:in `refresh!'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/rails/vendor_gem_source_index.rb:29:in `initialize'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/rails/gem_dependency.rb:21:in `new'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/initializer.rb:298:in `add_gem_load_paths'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/initializer.rb:132:in `process'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from /Users/bradrobertson/Repos/app/source/trunk/config/environment.rb:13
from /Users/bradrobertson/Repos/app/source/trunk/config/environment.rb:1:in `require'
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/commands/generate.rb:1
from /Users/bradrobertson/.rvm/gems/jruby-1.4.0/gems/rails-2.3.5/lib/commands/generate.rb:3:in `require'
from script/generate:3
Similarly running rake cucumber
I get
rake aborted!
source index not created from disk
So something obviously doesn't work. If I add that cucumber-rails directory back in, then my rake cucumber
actually runs.
Can someone tell me why it would need to install the gem right in my rails app? I've never seen this before.
setup
jruby-1.4.0
cucumber-0.7.2
cucumber-rails 0.3.1
bundler 0.9.23
webrat 0.7.1
EDIT
To add to this, I decided I was sick of trying to get this to work so I removed all cucumber / cucumber-rails deps from my Gemfile and reran bundle install
. It still creates the cucumber-rails directory and furthermore, I can't run anything unless that directory is present, (rake etc...) otherwise I get the source index not created from disk
message.
EDIT2
I just noticed that my Rails.root/.bundle/config
has BUNDLE_PATH: cucumber-rails
. Does anyone have any idea why this would be there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这与您使用捆绑器安装东西的方式有关。
你可能做了类似的事情:
bundle install cucumber-rails
如果你这样做,这个捆绑器会假设你想要供应你的捆绑包
位于项目内的此目录中。
你的.bundle/config
可能应该只包含:
BUNDLE_DISABLE_SHARED_GEMS: "1"
通过删除此文件夹,您实际上是在删除您的捆绑包。
只需像上面那样更改它,然后运行:
bundle install。
This has got to do with the way you are installing stuff with bundler.
you probably did something like:
bundle install cucumber-rails
If you do this bundler assumes you want to vendor your bundle
in this directory inside your project.
your .bundle/config
should probably just contain:
BUNDLE_DISABLE_SHARED_GEMS: "1"
By deleting this folder you are in fact deleting your bundle.
Just change this as above, and run:
bundle install.
我能够获得一个使用以下 gem 运行的从头开始的应用程序:
我必须升级到 Bundler 0.9.25,并且按照此处的说明将 Bundler 与 Rails 2 一起使用:
http://gembundler.com/rails23.html
这是我的 Gemfile 的外观:
I was able to get a from-scratch application running with the following gems:
I had to upgrade to Bundler 0.9.25 and I followed the instructions here for using Bundler with Rails 2:
http://gembundler.com/rails23.html
Here's how my Gemfile looked: