RubyZip:

A

Allen Fisher

Hello, all. I'm setting up some code to pull a zipped up build of our
software from a server, unzip it, and place it in a directory to be
tested against. I'm having some issues using the RubyZip gem. Here's my
stripped-down code:

require 'rubygems'
require 'zip/zip'

Zip::Zipfile.open("/Users/afisher/Desktop/TestSet.zip") do |zipfile|
dir = zipfile.dir
dir.entries('.').each do |entry|
zipfile.extract(entry,"/Users/afisher/Desktop")
end
end

When I run this code, I get the following error message:
$ ruby /Users/afisher/Desktop/ZipTest.rb
$ /Users/afisher/Desktop/ZipTest.rb:6: uninitialized constant
Zip::Zipfile (NameError)

This code is very similar to several sources I looked at on the web as
well as sample code that came with RubyZip, so I have to be doing
something glaringly wrong, but I can't seem to put my finger on it. I
even tried adding require 'zip/zipfilesystem' and that didn't seem to
help.

Thanks for any pointers on where to look, either in code or docs.

Allen
 
A

Allen Fisher

Allen said:
Hello, all. I'm setting up some code to pull a zipped up build of our
software from a server, unzip it, and place it in a directory to be
tested against. I'm having some issues using the RubyZip gem. Here's my
stripped-down code:

require 'rubygems'
require 'zip/zip'

Zip::Zipfile.open("/Users/afisher/Desktop/TestSet.zip") do |zipfile|
dir = zipfile.dir
dir.entries('.').each do |entry|
zipfile.extract(entry,"/Users/afisher/Desktop")
end
end

When I run this code, I get the following error message:
$ ruby /Users/afisher/Desktop/ZipTest.rb
$ /Users/afisher/Desktop/ZipTest.rb:6: uninitialized constant
Zip::Zipfile (NameError)

This code is very similar to several sources I looked at on the web as
well as sample code that came with RubyZip, so I have to be doing
something glaringly wrong, but I can't seem to put my finger on it. I
even tried adding require 'zip/zipfilesystem' and that didn't seem to
help.

Thanks for any pointers on where to look, either in code or docs.

Allen

Excuse me while I crawl back in my hole. I just discovered the problem.
ZipFile instead of Zipfile.

Sorry for the waste of bandwidth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,068
Latest member
MakersCBDIngredients

Latest Threads

Top