Rails config.gem

15 views
Skip to first unread message

Martin Streicher

unread,
Jul 17, 2009, 4:39:04 PM7/17/09
to mongod...@googlegroups.com

If I want to install the MongoDB extension as a gem, what do I place
in environment.rb?

config.gem 'mongodb-mongo_ext', :lib => 'ext'

does not work and every combination I have tried fails.

Answer?

Martin

Michael Dirolf

unread,
Jul 17, 2009, 4:46:52 PM7/17/09
to mongod...@googlegroups.com
You shouldn't need to add anything to environment.rb for the C
extension specifically, only for the main mongo gem. The mongo gem
handles loading mongo_ext when it needs to if you have it installed.

Michael Dirolf

unread,
Jul 17, 2009, 4:55:40 PM7/17/09
to mongod...@googlegroups.com
Actually after re-reading this I realized that my answer might not be
correct if you're relying on config.gem for installing dependencies on
a new system for example...

You probably need to specify add the source argument - something like:

config.gem 'mongodb-mongo_ext', :lib => false, :source => 'http://gems.github.com
'

Haven't tried this so YMMV.

Martin Streicher

unread,
Jul 17, 2009, 9:51:47 PM7/17/09
to mongod...@googlegroups.com

Right. I'll try it this evening.

What does :lib => false mean?

And what gem/plugin/thing adds the rake task gem:install_extensions?

Michael Dirolf

unread,
Jul 18, 2009, 12:38:42 PM7/18/09
to mongod...@googlegroups.com
Replies inline:

> Right. I'll try it this evening.
>
> What does :lib => false mean?

This tells rails to not auto-load the library. You shouldn't need to
auto-load the extension since it will be required explicitly by the
'mongo' gem.

> And what gem/plugin/thing adds the rake task gem:install_extensions?

This is a task in the Rakefile that ships with mongo-ruby-driver. So
you'd only use this if you're installing the extension gem manually,
from source. It's really just an alias for gem build, gem install.

Martin Streicher

unread,
Jul 18, 2009, 1:45:57 PM7/18/09
to mongod...@googlegroups.com

Got it. Thanks.

I have everything nicely configured in environments.rb and in my Rails
template to install the gems.

Michael Dirolf

unread,
Jul 18, 2009, 5:38:31 PM7/18/09
to mongod...@googlegroups.com
great!
Reply all
Reply to author
Forward
0 new messages