Class: Dragnet::Verifiers::ReposVerifier

Inherits:
Verifier
  • Object
show all
Defined in:
lib/dragnet/verifiers/repos_verifier.rb

Overview

Verifies the Repo objects attached to a TestRecord

Instance Attribute Summary collapse

Attributes inherited from Verifier

#test_record

Instance Method Summary collapse

Methods included from Helpers::RepositoryHelper

#relative_to_repo, #repo_base, #shorten_sha1

Constructor Details

#initialize(test_record:, multi_repository:) ⇒ ReposVerifier

Returns a new instance of ReposVerifier.

Parameters:



19
20
21
22
# File 'lib/dragnet/verifiers/repos_verifier.rb', line 19

def initialize(test_record:, multi_repository:)
  super(test_record: test_record)
  @multi_repository = multi_repository
end

Instance Attribute Details

#multi_repositoryObject (readonly)

Returns the value of attribute multi_repository.



13
14
15
# File 'lib/dragnet/verifiers/repos_verifier.rb', line 13

def multi_repository
  @multi_repository
end

Instance Method Details

#verifyDragnet::VerificationResult?

Carries out the verification of the Repo objects.

Returns:

  • (Dragnet::VerificationResult, nil)

    A VerificationResult object when the verification of any of the listed repositories fails and nil when all of them pass the verification.



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/dragnet/verifiers/repos_verifier.rb', line 28

def verify
  return unless test_record.repos&.any?

  test_record.repos.each do |repo|
    repository = fetch_repository(repo.path, multi_repository)
    verification_result = verify_repo(repo, repository)

    return verification_result if verification_result
  end
rescue Dragnet::Errors::NotARepositoryError => e
  Dragnet::VerificationResult.new(status: :failed, reason: e.message)
end