Class: Circle::CLI::Build
- Inherits:
-
Model
- Object
- Model
- Circle::CLI::Build
show all
- Defined in:
- lib/circle/cli/build.rb
Constant Summary
Constants inherited
from Model
Model::STATUS_COLORS, Model::TIME_FORMAT
Instance Attribute Summary collapse
Attributes inherited from Model
#attributes
Instance Method Summary
collapse
Methods inherited from Model
#[]
Constructor Details
#initialize(project, build = {}) ⇒ Build
Returns a new instance of Build.
9
10
11
12
|
# File 'lib/circle/cli/build.rb', line 9
def initialize(project, build = {})
@project = project
super(build)
end
|
Instance Attribute Details
#project ⇒ Object
Returns the value of attribute project.
7
8
9
|
# File 'lib/circle/cli/build.rb', line 7
def project
@project
end
|
Instance Method Details
#build_num ⇒ Object
20
21
22
|
# File 'lib/circle/cli/build.rb', line 20
def build_num
self[:build_num]
end
|
#cancel! ⇒ Object
52
53
54
|
# File 'lib/circle/cli/build.rb', line 52
def cancel!
project.request CircleCi::Build, :cancel, build_num
end
|
#color ⇒ Object
40
41
42
|
# File 'lib/circle/cli/build.rb', line 40
def color
color_for self[:status]
end
|
#details ⇒ Object
56
57
58
|
# File 'lib/circle/cli/build.rb', line 56
def details
@details ||= project.request CircleCi::Build, :get, build_num
end
|
#failed? ⇒ Boolean
28
29
30
|
# File 'lib/circle/cli/build.rb', line 28
def failed?
self[:outcome] == 'failed'
end
|
#failing_tests ⇒ Object
72
73
74
|
# File 'lib/circle/cli/build.rb', line 72
def failing_tests
tests.select(&failure_filter)
end
|
#finished? ⇒ Boolean
24
25
26
|
# File 'lib/circle/cli/build.rb', line 24
def finished?
!self[:outcome].nil?
end
|
44
45
46
|
# File 'lib/circle/cli/build.rb', line 44
def formatted_start_time
format_time(self[:start_time]) || 'Not started'
end
|
48
49
50
|
# File 'lib/circle/cli/build.rb', line 48
def formatted_stop_time
format_time(self[:start_time]) || 'Not finished'
end
|
#passing_tests ⇒ Object
68
69
70
|
# File 'lib/circle/cli/build.rb', line 68
def passing_tests
tests.reject(&failure_filter)
end
|
#preload ⇒ Object
14
15
16
17
18
|
# File 'lib/circle/cli/build.rb', line 14
def preload
tests
details
self
end
|
#status ⇒ Object
32
33
34
|
# File 'lib/circle/cli/build.rb', line 32
def status
self[:status].tr('_', ' ').capitalize
end
|
#steps ⇒ Object
60
61
62
|
# File 'lib/circle/cli/build.rb', line 60
def steps
details['steps'].map { |step| Step.new(step) }
end
|
#subject ⇒ Object
36
37
38
|
# File 'lib/circle/cli/build.rb', line 36
def subject
truncate self[:subject]
end
|
#tests ⇒ Object
64
65
66
|
# File 'lib/circle/cli/build.rb', line 64
def tests
@tests ||= project.request(CircleCi::Build, :tests, build_num)['tests']
end
|