Module: Jxedt::ZipUtils
- Defined in:
- lib/cocoapods-jxedt/git_helper/zip.rb
Class Method Summary collapse
Class Method Details
.unzip(path, to_dir: nil) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/cocoapods-jxedt/git_helper/zip.rb', line 14 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, zip_name: nil, to_dir: nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/cocoapods-jxedt/git_helper/zip.rb', line 3 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 |