lib/fake_zip.rb in fake_zip-0.0.1 vs lib/fake_zip.rb in fake_zip-0.0.2
- old
+ new
@@ -2,10 +2,13 @@
require 'yaml'
require 'forwardable'
require 'zip/zipfilesystem'
+def FakeZip file, structure
+ FakeZip.new file, structure
+end
module FakeZip
####################
@@ -44,9 +47,10 @@
####################
class FakeZip < Struct.new :file_structure
def save file
+ File.delete file if File.exist? file
Zip::ZipFile.open file, Zip::ZipFile::CREATE do |z|
dirs(struct).each do |dir|
z.dir.mkdir(dir) unless z.file.exist? dir
end
files(struct).each do |file|
\ No newline at end of file