Module: Travis::Client::States

Included in:
Annotation, Build, Job, Repository
Defined in:
lib/travis/client/states.rb

Constant Summary collapse

STATES =
%w[created queued received started passed failed errored canceled ready]

Instance Method Summary collapse

Instance Method Details

#canceled?Boolean

Returns:

  • (Boolean)


51
52
53
54
# File 'lib/travis/client/states.rb', line 51

def canceled?
  check_state
  state == 'canceled'
end

#colorObject



65
66
67
68
69
70
71
# File 'lib/travis/client/states.rb', line 65

def color
  case state
  when 'created', 'queued', 'received', 'started' then 'yellow'
  when 'passed', 'ready'                then 'green'
  when 'errored', 'canceled', 'failed'  then 'red'
  end
end

#created?Boolean

Returns:

  • (Boolean)


60
61
62
63
# File 'lib/travis/client/states.rb', line 60

def created?
  check_state
  !!state
end

#errored?Boolean

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/travis/client/states.rb', line 41

def errored?
  check_state
  state == 'errored'
end

#failed?Boolean

Returns:

  • (Boolean)


46
47
48
49
# File 'lib/travis/client/states.rb', line 46

def failed?
  check_state
  state == 'failed'
end

#finished?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/travis/client/states.rb', line 32

def finished?
  not pending?
end

#green?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/travis/client/states.rb', line 77

def green?
  color == 'green'
end

#passed?Boolean Also known as: successful?

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/travis/client/states.rb', line 36

def passed?
  check_state
  state == 'passed'
end

#pending?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/travis/client/states.rb', line 12

def pending?
  check_state
  %w[created started queued received ].include? state
end

#queued?Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/travis/client/states.rb', line 27

def queued?
  check_state
  state != 'created'
end

#ready?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/travis/client/states.rb', line 8

def ready?
  state == 'ready'
end

#received?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/travis/client/states.rb', line 22

def received?
  check_state
  state != 'created' and state != 'queued'
end

#red?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/travis/client/states.rb', line 81

def red?
  color == 'red'
end

#running?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/travis/client/states.rb', line 85

def running?
  state == 'started'
end

#started?Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/travis/client/states.rb', line 17

def started?
  check_state
  state != 'created' and state != 'received' and state != 'queued'
end

#unsuccessful?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/travis/client/states.rb', line 56

def unsuccessful?
  errored? or failed? or canceled?
end

#yellow?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/travis/client/states.rb', line 73

def yellow?
  color == 'yellow'
end