Class: CircleCI::CoverageReporter::Build

Inherits:
Struct
  • Object
show all
Defined in:
lib/circleci/coverage_reporter/build.rb

Overview

Encapsulate a CircleCI build

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#build_numberInteger

the ID of the CircleCI build

Returns:

  • (Integer)

    the current value of build_number



7
8
9
# File 'lib/circleci/coverage_reporter/build.rb', line 7

def build_number
  @build_number
end

#vcs_revisionString

revision of git

Returns:

  • (String)

    the current value of vcs_revision



7
8
9
# File 'lib/circleci/coverage_reporter/build.rb', line 7

def vcs_revision
  @vcs_revision
end

Instance Method Details

#artifactsArray<Artifact>

Returns:



15
16
17
# File 'lib/circleci/coverage_reporter/build.rb', line 15

def artifacts
  @artifacts ||= CoverageReporter.client.artifacts(build_number)
end

#find_artifact(string, node_index: nil) ⇒ Artifact?

Parameters:

  • string (String)
  • node_index (Integer, nil) (defaults to: nil)

Returns:



22
23
24
# File 'lib/circleci/coverage_reporter/build.rb', line 22

def find_artifact(string, node_index: nil)
  artifacts.find { |artifact| artifact.match?(string, node_index: node_index) }
end

#match?(revision) ⇒ Boolean

Parameters:

  • revision (String)

Returns:

  • (Boolean)


10
11
12
# File 'lib/circleci/coverage_reporter/build.rb', line 10

def match?(revision)
  vcs_revision.start_with?(revision)
end