Gem Confusion


I don't think this is a specific RubyMine question/problem, but I've gone through the forums and have seen similar problems addressed, so I thought maybe someone might be able to help me.

The crux of the problem is where the gems are installed. When I first used RubyMine (which I love!) I noticed it installed gems to my home directory : /home/larry/.gem/ruby/1.8/gems. The problem was I had already installed Phusion Passenger's Enterprise Ruby and it had created and populated a different directory with gems: /opt/ruby-enterprise/lib/ruby/gems/1.8/gems. I'll refer to these two directories as /larry and /enterprise from now on.

I decided to keep all of my gems in /enterprise because (a) a bunch were there already and (b) I thought I was asking for trouble if I had gems living in 2 different directories.

But now I'm thinking that might be causeing me problems...

I have cucumber installed in my project's /vendor directory. It requires the treetop gem. That is not vendored, rather it lives in the /enterprise directory. A few days ago I also noticed it somehow made its way into the /larry directory - so I deleted it. Now I can't fire up my app (i.e. mongrel) from RubyMine because it complains that cucumber is missing treetop. The funny part is that all of my cucumber tests still run fine - so cucumber is finding it.

It seems that gems are looking for other gems and not finding them. I ran the 'gem environment' command as per someone's suggestion in one of your forums and it spit out that my GEM PATHS: were both the /enterprise/~~~ (listed first) and /larry/~~~~ (listed second).

Should I be putting gems in my /larry directory as well? Should I remove the corresponding ones from the /enterprise directory if I do? (It seems having two copies is just asking for trouble.)

Could it be an access-privilege problem? I'm thinking maybe during startup that cucumber (via RubyMine) is trying to access the treetop gem, but it isn't allowed to look in /enterprise so it decides to look for it in /larry and then complains when it can't find it.

Sorry if this question is a little off-kilter. But it's one of those things I'm hoping someone will "just know" and will share their solution.


Comment actions Permalink

I found out what the problem was. I'll describe it here in case anyone else runs into this...

Cucumber has dependent gems treetop and polyglot. I initially vendored all 3, but when I did things didnt' work. So I unvendored treetop and polyglot. This meant cucumber was still in my /vendor/gems directory, while treetop and polyglot were over in my ruby/gems directory.

The only problem is that git is file-based. When I deleted the treetop and polyglot directories it deleted the files but left the (empty) directories in /vendor/gems.

So now when /vendor/gems/cucumber needs its treetop file, it looks around and sees a /vendor/gems/treetop directory and figures ah ha!... but unfortunately that directory is empty, and voila! - cucumber can't find the treetop file it needs and the process craps out.

Live and learn. (With any luck.)

BTW - am super-psyched for RubyMine 2.0!!!!!

-- Larry

Comment actions Permalink

Thanks Larry, I'll add additional check for our bundled gem scanner so it won't pick up empty directories left by git as gems.
Anyway, it is perfectly fine to have gems in you /enterprise directory, RubyMine will pick them up. The only reason RubyMine installs gem to your home directory is that currently we have no way to do 'sudo gem install'. Probably this will be fixed some time later.

Comment actions Permalink

Okay, Dennis. Thanks for the reply.

-- Larry


Please sign in to leave a comment.