gem 安装在捆绑文件夹(供应商/捆绑)上

bsr*_*bsr 8 ruby gem ruby-on-rails

我正在尝试安装一个 ruby​​ 项目,它具有像 Gemfile 中的依赖项

nokogiri (1.6.1)
Run Code Online (Sandbox Code Playgroud)

捆绑失败

An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)

I followed the instructions to install nokogiri manually and succeeded (OSX 10.9.2)

 which nokogiri
/usr/bin/nokogiri
nokogiri
Nokogiri: an HTML, XML, SAX, and Reader parser
Usage: nokogiri <uri|path> [options] ...
Run Code Online (Sandbox Code Playgroud)

but, how can I install nokogiri to the expected path by the app (vendor/bundle , like the other dependencies, not in system folder). I tried an option --path vendor/bundle with gem install, but it is not recognized

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Run Code Online (Sandbox Code Playgroud)

I am running gem install as another user, that is why no permission to write to system folder. still, it is not trying to install at vendor/bundle.

It is also ok if I can find a way to use bundle (instead of gem) to install nokogiri. But, I am not sure how to specify the dependencies like the installation command below.

gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 
                        --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib 
                        --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 
                        --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include 
                        --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Run Code Online (Sandbox Code Playgroud)

Зел*_*ный 5

Try to create config for bundler in ~/.bundle/config:

BUNDLE_PATH: ./vendor/bundle
BUNDLE_BUILD__NOKOGIRI: --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 
                        --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib 
                        --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 
                        --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include 
                        --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Run Code Online (Sandbox Code Playgroud)

and after bundle install --path vendor/bundle.