Sha256: a2238b22bc955c763ceceead7681306bd2092d8bcc54e178573e3046ba207e4c
Contents?: true
Size: 1.05 KB
Versions: 6
Compression:
Stored size: 1.05 KB
Contents
module GeoWorks module Processors module Zip extend ActiveSupport::Concern included do # Unzips a file, invokes a block, and then deletes the unzipped file(s). # Use to wrap processor methods for geo file formats that # are zipped before uploading. # @param in_path [String] file input path # @param output_file [String] processor output file path def self.unzip(in_path, output_file, _options = {}) basename = File.basename(output_file, File.extname(output_file)) zip_out_path = "#{File.dirname(output_file)}/#{basename}_out" execute "unzip -qq -j -d \"#{zip_out_path}\" \"#{in_path}\"" yield zip_out_path FileUtils.rm_rf(zip_out_path) end # Zips a file or directory. # @param in_path [String] file input path # @param output_file [String] output zip file def self.zip(in_path, output_file, _options = {}) execute "zip -j -qq -r \"#{output_file}\" \"#{in_path}\"" end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems