Rails:构建bundler gemfile的选项 [英] Rails: Options for build bundler gemfile

查看:101
本文介绍了Rails:构建bundler gemfile的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  gem install pg --with-pg-include 

= / Library / PostgreSQL / 9.0 / include / --with-pg-lib = / Library / PostgreSQL / 9.0 / lib /

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

  gempg, 0.12.2

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



thx,
tux

解决方案

这里是相关文章已在评论中:


编译选项

您可以使用 bundle config 给Bundler每次bundler尝试安装特定gem时将标志传递给gem安装程序。



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



  gem install mysql  -  --with-mysql-config = / usr / local / mysql / bin / mysql_config 




自特定位置的可执行文件可能会因机器而异,您可以在每台计算机上指定这些标记。




  bundle config build.mysql --with-mysql-config = / usr / local / mysql / bin / mysql_config 




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


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



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


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

解决方案

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

这篇关于Rails:构建bundler gemfile的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆