How to install gem with additional configuration using bundler?
I am implementing a geolocation library that requires the following gem installation
sudo gem install geoip_city -- --with-geoip-dir=/opt/GeoIP
I'm unsure of how I can add this to my Gemfile
.
When I push/deploy on my production 开发者_开发百科server, how can I link the gem to the geoip lib there as well?
If it makes a difference, I could probably use ./configure --prefix=/path/to/my_app/lib/
so that the C lib was installed directly inside my Rails 3 app. Or would this be advised against?
From about 3/4 of the way down this page on the Bundler website:
If you really need to pass flags to a C extension, you can use the bundle config command:
$ bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
Bundler will store this configuration in ~/.bundle/config, and bundler will use the configuration for any bundle install performed by the same user. As a result, once you specify the necessary build flags for a gem, you can successfully install that gem as many times as necessary.
精彩评论