Class: Herkko::Travis

Inherits:
Object
  • Object
show all
Defined in:
lib/herkko/travis.rb

Instance Method Summary collapse

Instance Method Details

#status_for(branch) ⇒ Object



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
# File 'lib/herkko/travis.rb', line 5

def status_for(branch)
  if travis_cli_installed?
    status = fetch_status(branch)
    if status[1].length > 0
      Herkko.info "There was an error with checking Travis: #{status[1]}"
      :red
    else
      if status[0].strip.length == 0
        :not_used
      else
        case status[0].split(":")[0]
        when /passed/
          :green
        when /started/
          :yellow
        when /created/
          :queued
        else
          :red
        end
      end
    end
  else
    Herkko.info "Travis CLI has not been installed, run: gem install travis"
    :unknown
  end
end