Sha256: a72bf40186428ef66371d6e584d36549552cfde0e47e65e1f590d1ffe819dc14
Contents?: true
Size: 631 Bytes
Versions: 9
Compression:
Stored size: 631 Bytes
Contents
module Jxedt module ZipUtils def self.zip(path, zip_name: nil, to_dir: nil) basename = File.basename(path) zip_name = basename if zip_name.nil? out_path = to_dir.nil? ? "#{zip_name}.zip" : "#{to_dir}/#{zip_name}.zip" cmd = [] cmd << "cd" << File.dirname(path) cmd << "&& zip -r --symlinks" << out_path << basename cmd << "&& cd -" `#{cmd.join(" ")}` end def self.unzip(path, to_dir: nil) cmd = [] cmd << "unzip -nq" << path cmd << "-d" << to_dir unless to_dir.nil? `#{cmd.join(" ")}` end end end
Version data entries
9 entries across 9 versions & 1 rubygems