module Zip
Public Class Methods
clean(dir)
click to toggle source
# File lib/zip.rb, line 12 def self.clean(dir) # TODO Refactor file check if Dir.exist?(dir) files = Dir.entries(dir) files.each do |file| next if (file == ".." || file == ".") if File.file?("#{dir}/#{file}") File.delete("#{dir}/#{file}") else Dir.delete("#{dir}/#{file}") end end Dir.delete(dir) end Dir.mkdir(dir) end
compress(*args)
click to toggle source
# File lib/zip.rb, line 2 def self.compress(*args) Miniz.zip(*args) end
uncompress(filezip, path = ".", application = true, clear_dir = true)
click to toggle source
# File lib/zip.rb, line 6 def self.uncompress(filezip, path = ".", application = true, clear_dir = true) dir = "#{path}/#{filezip.split(".").first}" if application clean(dir) if clear_dir Miniz.unzip(filezip, path) end