271ad4e354
The previous code relied on having on ref stored in commit, however the ref was moved to the build.
31 lines
495 B
Ruby
31 lines
495 B
Ruby
module Ci
|
|
module ProjectStatus
|
|
def status
|
|
last_commit.status if last_commit
|
|
end
|
|
|
|
def broken?
|
|
last_commit.failed? if last_commit
|
|
end
|
|
|
|
def success?
|
|
last_commit.success? if last_commit
|
|
end
|
|
|
|
def broken_or_success?
|
|
broken? || success?
|
|
end
|
|
|
|
def last_commit
|
|
@last_commit ||= commits.last if commits.any?
|
|
end
|
|
|
|
def last_commit_date
|
|
last_commit.try(:created_at)
|
|
end
|
|
|
|
def human_status
|
|
status
|
|
end
|
|
end
|
|
end
|