debian-mirror-gitlab/lib/gitlab/badge/build/status.rb

38 lines
691 B
Ruby
Raw Normal View History

2016-09-13 17:45:13 +05:30
module Gitlab
module Badge
module Build
##
# Build status badge
#
class Status < Badge::Base
attr_reader :project, :ref
def initialize(project, ref)
@project = project
@ref = ref
@sha = @project.commit(@ref).try(:sha)
end
def entity
'build'
end
def status
@project.pipelines
2017-08-17 22:00:37 +05:30
.where(sha: @sha)
.latest_status(@ref) || 'unknown'
2016-09-13 17:45:13 +05:30
end
def metadata
@metadata ||= Build::Metadata.new(self)
end
def template
@template ||= Build::Template.new(self)
end
end
end
end
end