Gem confusion, RubyMine vs CLI

I am using cucumber, and I have been having a lot of gem confusion. For example, when I run a feature test, I'll get an error like:

  You have already activated gherkin 2.3.3, but your Gemfile requires gherkin 2.2.9. Consider using bundle exec. (Gem::LoadError)

Ok, so I'm trying to figure out how to fix this. I look at my external libraries, and only 2.2.9 is installed. Now if I goto the CLI and run cucumber, it's just fine. I even go as far as to uninstall gherkin 2.3.3 and restart RubyMine, but that does not fix this issue. RubyMine is its own mindset. How do I fix/tweak this? Thanks

Eric



Attachment(s):
Gem confusion.png
0
4 comments
Avatar
Permanently deleted user

I have tried:
- File -> Synchronize
- File -> invalidate Caches

neither of these worked.

I have tried this in both:
- RubyMine 3.0.1
- RubyMine 3.1 EAP 102.217

Did not work for either Application.

0
Avatar
Permanently deleted user

Environment: Ubuntu 10.04, RubyMine 3.1 EAP 102.217, RVM, Ruby 1.9.2-p136

Ok, I have create a seperate gemset, as follows:

   ruby-1.9.2-p136@gemset-20110203 [ x86_64 ]
   ruby-1.9.2-p136 [ x86_64 ]

Currently, both gemsets are identical:
Gems included by the bundle:
  * abstract (1.0.0)
  * actionmailer (3.0.3)
  * actionpack (3.0.3)
  * activemodel (3.0.3)
  * activerecord (3.0.3)
  * activeresource (3.0.3)
  * activesupport (3.0.3)
  * arel (2.0.7)
  * builder (2.1.2)
  * bundler (1.0.10)
  * capistrano (2.5.19)
  * cucumber (0.9.4)
  * cucumber-rails (0.3.2)
  * diff-lcs (1.1.2)
  * erubis (2.6.6)
  * gherkin (2.2.9)
  * highline (1.6.1)
  * i18n (0.5.0)
  * json (1.4.6)
  * mail (2.2.15)
  * mime-types (1.16)
  * net-scp (1.0.4)
  * net-sftp (2.0.5)
  * net-ssh (2.1.0)
  * net-ssh-gateway (1.0.1)
  * nokogiri (1.4.4)
  * pg (0.10.1)
  * polyglot (0.3.1)
  * rack (1.2.1)
  * rack-mount (0.6.13)
  * rack-test (0.5.7)
  * rails (3.0.3)
  * railties (3.0.3)
  * rake (0.8.7)
  * rspec (2.4.0)
  * rspec-core (2.4.0)
  * rspec-expectations (2.4.0)
  * rspec-mocks (2.4.0)
  * rspec-rails (2.4.1)
  * term-ansicolor (1.0.5)
  * thor (0.14.6)
  * treetop (1.4.9)
  * tzinfo (0.3.24)
  * webrat (0.7.3)
  * webrat-rspec-rails (0.1.1)


If I run cucumber in environment (ruby-1.9.2-p136 [ x86_64 ]) then it works fine. However, if I run cucumber in this environment ( ruby-1.9.2-p136@gemset-20110203 [ x86_64 ] ), then I recieve this error:

ewanchic@noah:~/Projects/EMMIT$ cucumber
/home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:861:in `report_activate_error': RubyGem version error: gherkin(2.2.9 not ~> 2.3.2) (Gem::LoadError)
    from /home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:255:in `activate'
    from /home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:290:in `block in activate'
    from /home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:289:in `each'
    from /home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:289:in `activate'
    from /home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:1204:in `gem'
    from /home/ewanchic/.rvm/gems/ruby-1.9.2-p136@gemset-20110203/bin/cucumber:18:in `<main>'

Reseults are identical now, either in RubyMine or CLI. Looking for ideas in google about this error doesn't provide very much, but ironically it does pull up THIS thread :)

Does anyone have any ideas as to why this new gemset doesn't work?

Eric

0

Hello Eric,

You have already activated gherkin 2.3.3, but your Gemfile requires gherkin 2.2.9. Consider using bundle exec. (Gem::LoadError)


/home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:861:in `report_activate_error': RubyGem version error: gherkin(2.2.9 not ~> 2.3.2) (Gem::LoadError)
    from /home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:255:in `activate'
    from /home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:290:in `block in activate'
    from /home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:289:in `each'
    from /home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:289:in `activate'
    from /home/ewanchic/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:1204:in `gem'
    from /home/ewanchic/.rvm/gems/ruby-1.9.2-p136@gemset-20110203/bin/cucumber:18:in `<main>'



AFAIK such error relates (at least first error) to following problem. Your ~/../bin/cucumber script loads latest installed cucumber gem, then loads you application scripts. One of them loads Bundler which parses Gemfile and trying to activated mentioned gems. Thus gherking gem (cucumber depends on it) has been already activated by cucumber script and thus bundler cannot activate it. So there are two solutions:

1. More correct

If you launch cucumber script using "bundle exec" then the gem will be initially loaded by bundler and problem should gone. In RubyMine:

  • Open Run configuration settings, e.g. RubyMine | Run | Edit Configurations
  • Select your cucumber run configuration
  • Check "Run script in context of the bundle (bundle exec)" in "Bunlder" tab (also you may check the option in project defaults for cucumber run configuration)
  • Lauch run configuration again


2. In Cucumber run configuration settings please chose "'cucumber' gem version" the same as in Gemfile.

0

By the way, I hope you gemset name doesn't contain a whitespace character? Seems Ruby doesn't work well with whitespaces in paths.

0

Please sign in to leave a comment.