Sha256: 3fd32ab3a80a5071f792c5a884c3a7603601f4d74ef3beacb2088ed0503aa2d5

Contents?: true

Size: 665 Bytes

Versions: 1

Compression:

Stored size: 665 Bytes

Contents

# Copyright 2019 panda Holdings PTE LTE (panda), All rights reserved.
# Use of this source code is governed by an MIT-style license that can be found in the LICENSE file

require "digest/md5"

class FolderChecksum
  def self.git_checksum(dir)
    checksum_of_files(`git ls-files #{File.realdirpath(dir).shellescape}`.split("\n"))
  rescue => e
    Pod::UI.warn "Cannot get checksum of tracked files under #{dir}: #{e}"
    checksum_of_files(Dir["#{dir}/**/*"].reject { |f| File.directory?(f) })
  end

  def self.checksum_of_files(files)
    checksums = files.sort.map { |f| Digest::MD5.hexdigest(File.read(f)) }
    Digest::MD5.hexdigest(checksums.join)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-binary-ht-1.0.0 lib/cocoapods-binary-ht/helper/checksum.rb