Class: CIRunner::Check::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ci_runner/check/base.rb

Overview

Base class for a CI check.

Direct Known Subclasses

Buildkite, CircleCI, Github, Unsupported

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository, commit, name, status) ⇒ Base

Returns a new instance of Base.

Parameters:



27
28
29
30
31
32
# File 'lib/ci_runner/check/base.rb', line 27

def initialize(repository, commit, name, status)
  @repository = repository
  @commit = commit
  @name = name
  @status = status
end

Instance Attribute Details

#commitString (readonly)

Returns The Git commit that has been pushed to GitHub and for which we’ll retrieve the CI checks.

Returns:

  • (String)

    The Git commit that has been pushed to GitHub and for which we’ll retrieve the CI checks.



14
15
16
# File 'lib/ci_runner/check/base.rb', line 14

def commit
  @commit
end

#nameString (readonly)

Returns The name of that check. Should be whatever you had set in your CI configuration cile.

Returns:

  • (String)

    The name of that check. Should be whatever you had set in your CI configuration cile



17
18
19
# File 'lib/ci_runner/check/base.rb', line 17

def name
  @name
end

#repositoryString (readonly)

Returns The full repository name, including the owner (i.e. rails/rails).

Returns:

  • (String)

    The full repository name, including the owner (i.e. rails/rails)



11
12
13
# File 'lib/ci_runner/check/base.rb', line 11

def repository
  @repository
end

#statusString (readonly)

Returns The status from the GitHub API for this check. Can be a lot of different values. See the GitHub API.

Returns:

  • (String)

    The status from the GitHub API for this check. Can be a lot of different values. See the GitHub API.



21
22
23
# File 'lib/ci_runner/check/base.rb', line 21

def status
  @status
end

Instance Method Details

#download_logIO

Subclass have to implement this to download the log(s) output for the build.

Returns:

  • (IO)

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/ci_runner/check/base.rb', line 39

def download_log
  raise(NotImplementedError, "Subclass responsability")
end

#failed?Boolean



58
59
60
# File 'lib/ci_runner/check/base.rb', line 58

def failed?
  ["error", "failure"].include?(status)
end

#providerString

Used to tell the user which CI provider we are downloading the log output from.

Returns:

  • (String)

Raises:

  • (NotImplementedError)


46
47
48
# File 'lib/ci_runner/check/base.rb', line 46

def provider
  raise(NotImplementedError, "Subclass responsability")
end

#success?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/ci_runner/check/base.rb', line 51

def success?
  @status == "success"
end