Friday, March 18, 2011

Bundler is a great tool which helps to manage your application dependencies. It is very simple to use, just drop it and you are good to go with one command -> bundle install

Check out: http://gembundler.com/, if you care.

The problem occurs when it fails to install a gem. It does not have a way to show the trace of stack calls like rake --trace.

Let me tell you the problem - I was moving a Rails 2.3.9 project to use bundler. The application is using libxml-ruby for XML parsing (yes I know nokogiri fans - @tenderlove did a wonderful job).

The Gemfile entry:

gem 'libxml-ruby'


$ bundle install

and bundler tries to install the native extension (dependencies on zlib, libxml, iconv). I downloaded all the .dll's and copied them to Devkit.

$ bundle install

The same failure.

The nice bundle.config command:

$ bundle config build.libxml-ruby -- --with-zlib-dir=/path/to/zlib --with-zlib-include=/path/to/zlib/include --with-zlib-lib=/path/to/zlib/lib --with-iconv-dir=/path/to/iconv --with-iconv-lib=/path/to/iconv/lib --with-iconv-include=/path/to/iconv/include --with-xml2-dir=/path/to/libxml --with-xml2-lib=/path/to/libxml/lib --with-xml2-include=/path/to/libxml/include

$ bundle install

and I started to see the gem building, and then NOOOOO, version mismatch of the DLLs. I spent hours figuring out which are the compatible versions.

And then,

@niranjan suggested: this entry

$ bundle install

all worked, sweet !!

No comments: