6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/depends/util.rb', line 6
def self.un_zip(source,destination, options = {})
options.reverse_merge!({:overwrite => true})
Log.debug "Opening #{source}"
Zip::ZipFile.open(source) do |zip|
zip.each do |entry|
Log.debug (":entry => #{entry.name}")
path = ::File.join(destination, entry.name)
FileUtils.mkdir_p(::File.dirname(path))
if options[:overwrite] && ::File.exists?(path) && !::File.directory?(path)
Log.debug("Removing #{path}")
FileUtils.rm(path)
end
zip.(entry, path)
end
end
end
|