Hello,

The spoiler: Warbler wants rubyzip 0.9.4, buildr demands 0.9.1. If buildr gemspec is updated to >=, a type error pops up due to autoload :Zip, 'buildr/packaging/zip' in lib/buildr/packaging.rb. What is the autoload providing? Changing it to a require makes the specs angry, so there is some magic going into the sauce.

The yarn: So I kicked maven to the curb for buildr on a spring web + jruby rails project. Oh man, a breath of fresh air. When trying to use the latest warbler to package the project, I got the following:

RubyGem version error: rubyzip(0.9.4 not = 0.9.1) (Gem::LoadError)

buildr is pinned at rubyzip 0.9.1 and warbler is looking for the latest. Ok, that is simple enough. I cloned buildr at github and updated the gemspec to allow rubyzip >= 0.9.1. Unfortunately, that turned up:

TypeError : superclass mismatch for class ZipFile

Hrm, odd. I started poking around buildr a little and figured out the lib/buildr/packaging.rb is calling autoload :Zip, 'buildr/packaging/zip' which is causing problems when warbler is requiring rubyzip. So I blindly changed the autoload to require 'buildr/packaging/zip' and that fixed that issue, but another error sprung up directly from rubyzip:

NoMethodError : undefined method `length' for -1:Fixnum
/home/zinger/.rvm/gems/jruby-1....@rails3/gems/rubyzip-0.9.4/lib/zip/zip.rb:732:in `write_c_dir_entry'

Cuuuuurses! Rubyzip's Zip::ZipEntry#write_c_dir_entry has comment = -1 when it expects a string, the angry line of code:

732: @comment ? comment.length : 0,

Somehow, the entry's comment being produced from buildr returns a -1. Yet again, swinging in the dark, I override the write_c_dir_entry method in buildr and simply add a to_s method call to comment:

@comment ? comment.to_s.length : 0,

Horray, the project builds! I thought about directly patching rubyzip, but it is crammed in cvs under sourceforge and I have had enough abuse for the time being. I added the override to lb/buildr/packaging/zip.rb

My fork of buildr on github - https://github.com/mguymon/buildr

versions

zin...@imperator:~/devel/src/ruby/mguymon-buildr$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
zin...@imperator:~/devel/src/ruby/mguymon-buildr$ jruby -v
jruby 1.1.6 (ruby 1.8.6 patchlevel 114) (2009-06-12 rev 6586) [amd64-java]
zin...@imperator:~/devel/src/ruby/mguymon-buildr$ buildr --version
Buildr 1.4.3

thanks,
Michael

Reply via email to