Sha256: 530aa44fecabbbfb9b5873e6ffcf642c49efb6c353333532c3e6066902f982a1

Contents?: true

Size: 667 Bytes

Versions: 22

Compression:

Stored size: 667 Bytes

Contents

# Copyright 2019 Grabtaxi Holdings PTE LTE (GRAB), 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

22 entries across 22 versions & 3 rubygems

Version Path
cocoapods-binary-artifactory-cache-0.0.1 lib/cocoapods-binary-artifactory-cache/helper/checksum.rb
cocoapods-binary-cache-0.1.14 lib/cocoapods-binary-cache/helper/checksum.rb