问题
I have a gem, that must be build with some options.
gem install pg --with-pg-include=/Library/PostgreSQL/9.0/include/ --with-pg-lib=/Library/PostgreSQL/9.0/lib/
Can I include this options in the Gemfile? In my Gemfile the pg command is
gem "pg", "0.12.2"
I want to provide some options after the version number.
thx, tux
回答1:
Here is the relevant text from the link posted in comments already:
BUILD OPTIONS
You can use
bundle configto give bundler the flags to pass to the gem installer every time bundler tries to install a particular gem.A very common example, the
mysqlgem, requires Snow Leopard users to pass configuration flags togem installto specify where to find themysql_configexecutable.
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Since the specific location of that executable can change from machine to machine, you can specify these flags on a per-machine basis.
bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
After running this command, every time bundler needs to install the
mysqlgem, it will pass along the flags you specified.
Here is another example of custom build options, in this case specifying a specific source to download from other than rubygems:
bundle config build.popen4 --source http://gemcutter.org
来源:https://stackoverflow.com/questions/9166146/rails-options-for-build-bundler-gemfile