passing configure options to rake gems:build
On the server (where I am not root), I have compiled libxslt into /home/foo/sw
.
So I can install my gem like so:
gem install nokogiri -- --with-xslt-dir=/home/foo/sw
However, this same technique doesn't work with rake:
$ rake gems开发者_StackOverflow:build -- --with-xslt-dir=/home/foo/sw
(in /home/foo/fooapp/releases/20100915071151)
If I try to force a build, I get the path error:
$ rake gems:build:force -- --with-xslt-dir=/home/foo/sw
(in /home/foo/fooapp/releases/20100915071151)
rake aborted!
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... no
-----
libxslt is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
How can I make this work with rake (and thus Capistrano)?
No way. Firstly rake uses env like params "rake .... RAILS_ENV=production". Secondly gems:build rake task doesn't pass any additional params to
Rails::GemBuilder.new(specification, gem_dir).build_extensions
In rails/railties/lib/tasks/gems.rake .
The solution would be writing own task or using bundler.
精彩评论