Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_status.rb « ci « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b66f1212f239da967a16480ac2fe9b5d428edbc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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

    def last_commit_for_ref(ref)
      commits.where(ref: ref).last
    end
  end
end