Class: CIRunner::Check::Base
- Inherits:
-
Object
- Object
- CIRunner::Check::Base
- Defined in:
- lib/ci_runner/check/base.rb
Overview
Base class for a CI check.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#commit ⇒ String
readonly
The Git commit that has been pushed to GitHub and for which we’ll retrieve the CI checks.
-
#name ⇒ String
readonly
The name of that check.
-
#repository ⇒ String
readonly
The full repository name, including the owner (i.e. rails/rails).
-
#status ⇒ String
readonly
The status from the GitHub API for this check.
Instance Method Summary collapse
-
#download_log ⇒ IO
Subclass have to implement this to download the log(s) output for the build.
- #failed? ⇒ Boolean
-
#initialize(repository, commit, name, status) ⇒ Base
constructor
A new instance of Base.
-
#provider ⇒ String
Used to tell the user which CI provider we are downloading the log output from.
- #success? ⇒ Boolean
Constructor Details
#initialize(repository, commit, name, status) ⇒ Base
Returns a new instance of Base.
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
#commit ⇒ String (readonly)
Returns 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 |
#name ⇒ String (readonly)
Returns 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 |
#repository ⇒ String (readonly)
Returns 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 |
#status ⇒ String (readonly)
Returns 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_log ⇒ IO
Subclass have to implement this to download the log(s) output for the build.
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 |
#provider ⇒ String
Used to tell the user which CI provider we are downloading the log output from.
46 47 48 |
# File 'lib/ci_runner/check/base.rb', line 46 def provider raise(NotImplementedError, "Subclass responsability") end |
#success? ⇒ Boolean
51 52 53 |
# File 'lib/ci_runner/check/base.rb', line 51 def success? @status == "success" end |