Rails:构建bundler gemfile的选项

时间:2021-05-11 00:21:51

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

我可以在Gemfile中包含这些选项吗?在我的Gemfile中,pg命令是

gem "pg", "0.12.2"

I want to provide some options after the version number.

我想在版本号后面提供一些选项。

thx, tux

1 个解决方案

#1


11  

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.

每次bundler尝试安装特定的gem时,您都可以使用bundle config为Bundler提供传递给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.

一个非常常见的例子是mysql gem,它要求Snow Leopard用户将配置标志传递给gem install,以指定在哪里找到mysql_config可执行文件。

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.

运行此命令后,每次bundler需要安装mysql gem时,它都会传递你指定的标志。

Here is another example of custom build options, in this case specifying a specific source to download from other than rubygems:

以下是自定义构建选项的另一个示例,在这种情况下,指定要从rubygems以外的地方下载的特定源:

bundle config build.popen4 --source http://gemcutter.org

bundle config build.popen4 --source http://gemcutter.org

#1


11  

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.

每次bundler尝试安装特定的gem时,您都可以使用bundle config为Bundler提供传递给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.

一个非常常见的例子是mysql gem,它要求Snow Leopard用户将配置标志传递给gem install,以指定在哪里找到mysql_config可执行文件。

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.

运行此命令后,每次bundler需要安装mysql gem时,它都会传递你指定的标志。

Here is another example of custom build options, in this case specifying a specific source to download from other than rubygems:

以下是自定义构建选项的另一个示例,在这种情况下,指定要从rubygems以外的地方下载的特定源:

bundle config build.popen4 --source http://gemcutter.org

bundle config build.popen4 --source http://gemcutter.org