Module: PodPrebuild::ZipUtils
- Defined in:
- lib/command/helper/zip.rb
Class Method Summary collapse
Class Method Details
.unzip(path, to_dir: nil) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/command/helper/zip.rb', line 13 def self.unzip(path, to_dir: nil) cmd = [] cmd << "unzip -nq" << path cmd << "-d" << to_dir unless to_dir.nil? `#{cmd.join(" ")}` end |
.zip(path, to_dir: nil) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/command/helper/zip.rb', line 3 def self.zip(path, to_dir: nil) basename = File.basename(path) out_path = to_dir.nil? ? "#{basename}.zip" : "#{to_dir}/#{basename}.zip" cmd = [] cmd << "cd" << File.dirname(path) cmd << "&& zip -r --symlinks" << out_path << basename cmd << "&& cd -" `#{cmd.join(" ")}` end |