Forum: Ruby unzip EAR file?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-05-19 00:59
(Received via mailing list)
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
Peter S. (Guest)
on 2006-05-19 01:31
(Received via mailing list)
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
unknown (Guest)
on 2006-05-19 02:27
(Received via mailing list)
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
This topic is locked and can not be replied to.