Sha256: 9bac1cce66f7f02dfce7fe999b2ce90d299c389c4024fcbf9cece26695952a58

Contents?: true

Size: 731 Bytes

Versions: 6

Compression:

Stored size: 731 Bytes

Contents

module PodPrebuild
  module ZipUtils
    def self.zip(path, to_dir: nil, name: nil)
      basename = File.basename(path)
      toname = name.nil? ? basename : name
      unless to_dir.nil? 
        FileUtils.mkdir_p(to_dir)
      end
      
      out_path = to_dir.nil? ? "#{toname}.zip" : "#{to_dir}/#{toname}.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 -oq" << path
      cmd << "-d" << to_dir unless to_dir.nil?
      `#{cmd.join(" ")}`
      if $? != 0 
        return false
      end
      return true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cocoapods-binary-artifactory-cache-0.0.19 lib/command/helper/zip.rb
cocoapods-binary-artifactory-cache-0.0.18 lib/command/helper/zip.rb
cocoapods-binary-artifactory-cache-0.0.17 lib/command/helper/zip.rb
cocoapods-binary-artifactory-cache-0.0.16 lib/command/helper/zip.rb
cocoapods-binary-artifactory-cache-0.0.15 lib/command/helper/zip.rb
cocoapods-binary-artifactory-cache-0.0.14 lib/command/helper/zip.rb