class KPM::BaseArtifact
def skip_if_exists(artifact_info, coordinates, sha1_file)
def skip_if_exists(artifact_info, coordinates, sha1_file) # Unclear if this is even possible return false if artifact_info[:sha1].nil? # Check entry in sha1_file if exists if sha1_file && File.exists?(sha1_file) sha1_checker = Sha1Checker.from_file(sha1_file) local_sha1 = sha1_checker.sha1(coordinates) return true if local_sha1 == artifact_info[:sha1] end # If not using sha1_file mechanism, exit early if file_path odes not exist or is a directory if !File.exists?(artifact_info[:file_path]) || File.directory?(artifact_info[:file_path]) return false end # Finally check if remote_sha1 matches what we have locally local_sha1 = Digest::SHA1.file(artifact_info[:file_path]).hexdigest local_sha1 == artifact_info[:sha1] end