Unzip EAR file?


#1

Hello group. New to ruby and needing the ability to unzip EAR files.
Isn’t
an EAR file technically just a zip file? I’ve been able to untar
tarballs
and unzip zip files in Ruby but failed for ear files. Any pointers
appreciated.

Error msg: bad value for range

def unzip(zipfile, dest)
zf = Zip::ZipFile.open(zipfile)
zf.each do |entry|
begin
file=file_to_basename(entry)
File.makedirs("#{dest}/#{file}") unless File.exists?
“#{dest}/#{file}”
zf.extract(entry, “#{dest}/#{entry.name}”)
rescue Exception => e
log(“Error while unzipping: #{dest}/#{file}: #{e}”, 1)
end
end
end


#2

Cliff C. wrote:

Hello group. New to ruby and needing the ability to unzip EAR files. Isn’t
an EAR file technically just a zip file? I’ve been able to untar tarballs
and unzip zip files in Ruby but failed for ear files. Any pointers
appreciated.
I am just writing a deployment script for a web app, and there I am
unzipping WAR files without any problems (EAR should be the same from
this POV) with standard *nix zip.

pete@dello:~$ file metasearch.war
metasearch.war: Zip archive data, at least v1.0 to extract

I have never used unzip from Ruby for WAR/EAR files though - I am really
curious now why should it not work?

Peter


#3

On Fri, May 19, 2006 at 06:29:05AM +0900, Peter S. wrote:

pete@dello:~$ file metasearch.war
metasearch.war: Zip archive data, at least v1.0 to extract

I have never used unzip from Ruby for WAR/EAR files though - I am really
curious now why should it not work?

Peter

Yes, it is a strange one…It looks like it starts to unarchive the
files but
it chokes while extracting a war file from the ear.

from unzip in ruby:

path: ./tmp/ADT110_1.1.0.2/ADT/Install/ADT.ear
Error while unzipping: ADTWeb.war : bad value for range

system unzip shows the ADTWeb.war that fails in the ruby zip lib.

[ccyphers@ccyphers Install]$ unzip ADT.ear
Archive: ADT.ear
inflating: ADTWeb.war
creating: META-INF/
inflating: META-INF/.modulemaps
inflating: META-INF/application.xml
inflating: META-INF/ibm-application-ext.xmi
inflating: META-INF/MANIFEST.MF