Rails: Options for build bundler gemfile

此生再无相见时 提交于 2020-01-01 02:44:09

问题


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 config to give bundler the flags to pass to the gem installer every time bundler tries to install a particular gem.

A very common example, the mysql gem, requires Snow Leopard users to pass configuration flags to gem install to specify where to find the mysql_config executable.

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 mysql gem, 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!