Class: MatrixCi::Build
- Inherits:
-
Object
- Object
- MatrixCi::Build
- Defined in:
- lib/build.rb
Instance Method Summary collapse
- #cancel ⇒ Object
-
#initialize(options) ⇒ Build
constructor
A new instance of Build.
- #retry ⇒ Object
- #running? ⇒ Boolean
- #runtime ⇒ Object
- #show ⇒ Object
- #successful? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(options) ⇒ Build
Returns a new instance of Build.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/build.rb', line 6 def initialize() @id = [:id] @branch = [:branch] @committer = [:committer] @started = [:started] @ended = [:ended] @outcome = [:outcome] @subject = [:subject] @ref = [:ref] @projectname = [:projectname] end |
Instance Method Details
#cancel ⇒ Object
44 45 |
# File 'lib/build.rb', line 44 def cancel end |
#retry ⇒ Object
47 48 |
# File 'lib/build.rb', line 47 def retry end |
#running? ⇒ Boolean
36 37 38 |
# File 'lib/build.rb', line 36 def running? @ended.nil? end |
#runtime ⇒ Object
40 41 42 |
# File 'lib/build.rb', line 40 def runtime (DateTime.parse(@ended) - DateTime.parse(@started)).to_i/60 end |
#show ⇒ Object
50 51 |
# File 'lib/build.rb', line 50 def show end |
#successful? ⇒ Boolean
32 33 34 |
# File 'lib/build.rb', line 32 def successful? @outcome != "failed" end |
#to_s ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/build.rb', line 18 def to_s str = "%s %10s %10s %40s %25s %15s %s" % [@id, @started.nil? ? "?" : @started[11,8], @projectname, @branch, @committer, @ref, @subject] color = :white if running? color = :yellow else color = :green if successful? color = :red unless successful? end str.foreground(color) end |