Class: Fuci::Travis::Build
- Inherits:
-
Object
- Object
- Fuci::Travis::Build
show all
- Extended by:
- Forwardable, Git
- Includes:
- Git
- Defined in:
- lib/fuci/travis/build.rb,
lib/fuci/travis/build/master.rb,
lib/fuci/travis/build/generic.rb,
lib/fuci/travis/build/pull_request.rb,
lib/fuci/travis/build/sha_detectable.rb
Defined Under Namespace
Modules: ShaDetectable
Classes: Generic, Master, PullRequest
Constant Summary
collapse
- FAILED =
'failed'
- PASSED =
'passed'
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(branch_name) ⇒ Build
Returns a new instance of Build.
20
21
22
|
# File 'lib/fuci/travis/build.rb', line 20
def initialize branch_name
@branch_name = branch_name
end
|
Instance Attribute Details
#branch_name ⇒ Object
Returns the value of attribute branch_name.
17
18
19
|
# File 'lib/fuci/travis/build.rb', line 17
def branch_name
@branch_name
end
|
Class Method Details
.create ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/fuci/travis/build.rb', line 47
def self.create
if Fuci::Travis::CliOptions.pull_request?
branch_name =
Fuci::Travis::CliOptions.pull_request_branch || current_branch_name
return PullRequest.new branch_name
end
branch_name =
Fuci::Travis::CliOptions.branch ||
Fuci::Travis.default_branch ||
current_branch_name
from_branch_name branch_name
end
|
.from_branch_name(branch_name) ⇒ Object
63
64
65
66
67
68
69
|
# File 'lib/fuci/travis/build.rb', line 63
def self.from_branch_name branch_name
if branch_name == 'master'
Master.new
else
Generic.new branch_name
end
end
|
Instance Method Details
#branch ⇒ Object
39
40
41
|
# File 'lib/fuci/travis/build.rb', line 39
def branch
@branch ||= build_branch
end
|
#build_branch ⇒ Object
43
44
45
|
# File 'lib/fuci/travis/build.rb', line 43
def build_branch
raise NotImplementedError
end
|
#log ⇒ Object
35
36
37
|
# File 'lib/fuci/travis/build.rb', line 35
def log
jobs.first.log.body
end
|
#status ⇒ Object
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/fuci/travis/build.rb', line 24
def status
case state
when FAILED
:red
when PASSED
:green
else
:yellow
end
end
|