Class: CruiseFace::Model::Pipeline::History::Stage

Inherits:
Object
  • Object
show all
Defined in:
lib/cruise_face/pipeline.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pipeline, resource) ⇒ Stage

Returns a new instance of Stage.



55
56
57
58
# File 'lib/cruise_face/pipeline.rb', line 55

def initialize(pipeline, resource)
  @pipeline = pipeline
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



54
55
56
# File 'lib/cruise_face/pipeline.rb', line 54

def resource
  @resource
end

Instance Method Details

#building?Boolean

the stageStatus maybe ‘Failed’ when there is one job failed and others are still building

Returns:

  • (Boolean)


73
74
75
# File 'lib/cruise_face/pipeline.rb', line 73

def building?
  jobs.any? {|job| job.incompleted?}
end

#committersObject



60
61
62
# File 'lib/cruise_face/pipeline.rb', line 60

def committers
  @pipeline.committers
end

#completed?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/cruise_face/pipeline.rb', line 64

def completed?
  !building?
end

#counterObject



81
82
83
# File 'lib/cruise_face/pipeline.rb', line 81

def counter
  @resource.stageCounter
end

#jobsObject



89
90
91
# File 'lib/cruise_face/pipeline.rb', line 89

def jobs
  @jobs ||= @pipeline.find_jobs(self)
end

#nameObject



77
78
79
# File 'lib/cruise_face/pipeline.rb', line 77

def name
  @resource.stageName
end

#to_sObject



85
86
87
# File 'lib/cruise_face/pipeline.rb', line 85

def to_s
  "#{name}<#{counter}>[#{@pipeline}]"
end

#unknown?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/cruise_face/pipeline.rb', line 68

def unknown?
  UNKNOWN_STATUS == @resource.stageStatus
end