Commit d47aef58 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Add Ci::Status::Stage

parent 2f972ad4
......@@ -6,6 +6,8 @@ module Ci
attr_reader :pipeline, :name
delegate :project, to: :pipeline
def initialize(pipeline, name: name, status: nil)
@pipeline, @name, @status = pipeline, name, status
end
......
module Gitlab
module Ci
module Status
module Stage
module Common
def has_details?
true
end
def details_path
namespace_project_pipeline_path(@subject.project.namespace,
@subject.project,
@subject,
anchor: subject.name)
end
def has_action?
false
end
end
end
end
end
end
module Gitlab
module Ci
module Status
module Stage
class Factory
EXTENDED_STATUSES = []
def initialize(stage)
@stage = stage
@status = stage.status || :created
end
def fabricate!
if extended_status
extended_status.new(core_status)
else
core_status
end
end
private
def core_status
Gitlab::Ci::Status
.const_get(@status.capitalize)
.new(@stage)
.extend(Status::Pipeline::Common)
end
def extended_status
@extended ||= EXTENDED_STATUSES.find do |status|
status.matches?(@stage)
end
end
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment