Sha256: 6110a2f5e13d482c91a4a3e27ae5049400bfb758225071e34aff0aafca334e41
Contents?: true
Size: 646 Bytes
Versions: 9
Compression:
Stored size: 646 Bytes
Contents
require 'albacore/albacoretask' require 'zip/zip' require 'zip/zipfilesystem' include Zip class Unzip include Albacore::Task attr_accessor :destination, :file def initialize super() update_attributes Albacore.configuration.unzip.to_hash end def execute() fail_with_message 'Zip File cannot be empty' if @file.nil? return if @file.nil? Zip::ZipFile.open(@file) do |zip_f| zip_f.each do |f| out_path = File.join(@destination, f.name) FileUtils.mkdir_p(File.dirname(out_path)) zip_f.extract(f, out_path) unless File.exist?(out_path) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems