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.
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.