Class: Dragnet::Verifiers::FilesVerifier

Inherits:
RepositoryVerifier show all
Defined in:
lib/dragnet/verifiers/files_verifier.rb

Overview

Checks if any of the files listed in the MTR have changed since the MTR was created.

Instance Attribute Summary

Attributes inherited from RepositoryVerifier

#repository

Attributes inherited from Verifier

#test_record

Instance Method Summary collapse

Methods inherited from RepositoryVerifier

#initialize

Methods inherited from Verifier

#initialize

Methods included from Helpers::RepositoryHelper

#relative_to_repo, #repo_base, #shorten_sha1

Constructor Details

This class inherits a constructor from Dragnet::Verifiers::RepositoryVerifier

Instance Method Details

#verifyDragnet::VerificationResult?

Executes the verification process. Checks the changes in the repository. If a change in one of the files is detected a :result key is added to the MTR, including the detected change.

Returns:

  • (Dragnet::VerificationResult, nil)

    A VerificationResult object with the detected changes to the listed files or nil if no changes are found.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dragnet/verifiers/files_verifier.rb', line 18

def verify
  changes = []

  files.each do |file|
    diff = repository.diff(sha1, 'HEAD').path(file.to_s)
    next unless diff.size.positive?

    changes << file
  end

  result_from(changes) if changes.any?
end