gitlab-org--gitlab-foss/lib/gitlab/badge/build/status.rb
Douwe Maan 56de781a2c Revert "Enable Style/DotPosition"
This reverts commit e00fb2bdc2090e9cabeb1eb35a2672a882cc96e9.

# Conflicts:
#	.rubocop.yml
#	.rubocop_todo.yml
#	lib/gitlab/ci/config/entry/global.rb
#	lib/gitlab/ci/config/entry/jobs.rb
#	spec/lib/gitlab/ci/config/entry/factory_spec.rb
#	spec/lib/gitlab/ci/config/entry/global_spec.rb
#	spec/lib/gitlab/ci/config/entry/job_spec.rb
#	spec/lib/gitlab/ci/status/build/factory_spec.rb
#	spec/lib/gitlab/incoming_email_spec.rb
2017-02-23 09:33:19 -06:00

37 lines
691 B
Ruby

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
.where(sha: @sha)
.latest_status(@ref) || 'unknown'
end
def metadata
@metadata ||= Build::Metadata.new(self)
end
def template
@template ||= Build::Template.new(self)
end
end
end
end
end