views:

388

answers:

2

Hello,

total ruby newbie, trying to setup a Rails/MongoDB application on Mac OS X Snow leopard.

Installed Ruby 1.9.1 and RubyGems 1.3.7, which ruby and which gem point to the same directory. I'm using the Snow Leopard built-in apache and Passenger 2.2.11. I'm using the rails template from the mongo-site which seems to work okay overall.

The exact error that passenger gives me is:

/Users/User/Sites/feuerapp/vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement **Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance. You can install the extension as follows: gem install bson_ext If you continue to receive this message after installing, make sure that the bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version. Missing these required gems: redgreen You're running: ruby 1.9.1.376 at /usr/local/bin/ruby rubygems 1.3.7 at /Users/User/.gem/ruby/1.9.1, /usr/local/lib/ruby/gems/1.9.1 Runrake gems:installto install the missing gems.

The weird thing is that redgreen is installed and looks fine to me:

Dahlia:feuerapp User$ ls -la vendor/gems/
total 0
drwxr-xr-x 7 User staff 238 May 18 22:56 .
drwxr-xr-x 5 User staff 170 May 18 23:00 ..
drwxr-xr-x 11 User staff 374 May 18 22:56 factory_girl-1.2.4
drwxr-xr-x 11 User staff 374 May 18 22:56 mocha-0.9.8
drwxr-xr-x 7 User staff 238 May 18 22:56 mongo_mapper-0.7.6
drwxr-xr-x 7 User staff 238 May 18 22:56 redgreen-1.2.2
drwxr-xr-x 11 User staff 374 May 18 22:56 shoulda-2.10.3

Commenting out this line in environment.rb "solves" the issue, but that's not really want I want:

config.gem 'redgreen'

I don't understand anything of gems yet, but from my limited understanding, redgreen should be there and found?

A: 

Perhaps it's not telling you that it's looking for a different version of the gem for whatever reason. If you run (sudo) rake gems:install and try again, do you get the same message? The gem dependency business is a bit of a pain in the ass, to say the least.

Also, in particular to this case, I would say that removing redgreen is not the end of the world. Since it's specific to testing, you could also move the gem dependency into the environments/test.rb (or whatever other testing environments are set up) and not have to deal with it in development/staging/production.

Any gems that are dependent on testing should only be specified for your testing environments and not for your entire application.

theIV
Yes, rake gems:install doesn't change anything. I've tried rm -rf vendor/gems and re-ran rake gems:install / rake gems:unpack. It unpacked the redgreen-1.2.2 gem.
Michael Stum
+3  A: 

Okay, found it, I was missing the test-unit gem.

How I found it? I went to vendor/gems/redgreen-1.2.2/lib/redgreen.rb and looked at the "require" statements, which lists "test/unit". Quick googling led me to the test-unit gem, and after gem install test-unit it works now.

I'm not sure if I can tell rake somehow that there is a dependency and I'm a bit disappointed that there was no better error message, but at least that's resolved now.

Michael Stum
Glad you figured it out. You are right in that the error message gave you no heads up as to what the hell was going on. :[
theIV