Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

I was able to get a from-scratch application running with the following gems:

$ jruby -S gem list

*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activerecord-jdbc-adapter (0.9.6)
activeresource (2.3.5)
activesupport (2.3.5)
builder (2.1.2)
bundler (0.9.25)
cucumber (0.7.2)
cucumber-rails (0.3.1)
database_cleaner (0.5.2)
diff-lcs (1.1.2)
gherkin (1.0.24)
jdbc-sqlite3 (3.6.3.054)
jruby-openssl (0.7)
json_pure (1.4.3)
nokogiri (1.4.1)
rack (1.0.1)
rack-test (0.5.3)
rails (2.3.5)
rake (0.8.7)
term-ansicolor (1.0.5)
trollop (1.16.2)
webrat (0.7.1)

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:

source :gemcutter
gem "rails", "~> 2.3.5"
gem 'activerecord-jdbc-adapter', :require => false
gem 'jdbc-sqlite3', :require => false

group :development do
end

group :test do
  gem 'cucumber-rails'
  gem 'webrat'
  gem 'database_cleaner'
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top