Class: Vx::Builder::BuildConfiguration
- Inherits:
-
Object
- Object
- Vx::Builder::BuildConfiguration
show all
- Defined in:
- lib/vx/builder/build_configuration.rb,
lib/vx/builder/build_configuration/env.rb,
lib/vx/builder/build_configuration/cache.rb,
lib/vx/builder/build_configuration/deploy.rb,
lib/vx/builder/build_configuration/artifacts.rb
Defined Under Namespace
Classes: Artifacts, Cache, Deploy, Env
Constant Summary
collapse
- ATTRIBUTES =
%w{
rvm
scala
jdk
language
gemfile
services
image
bundler_args
before_install
before_script
script
after_success
}
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(new_attributes = {}, matrix_attributes = {}) ⇒ BuildConfiguration
Returns a new instance of BuildConfiguration.
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/vx/builder/build_configuration.rb', line 43
def initialize(new_attributes = {}, matrix_attributes = {})
new_attributes = {} unless new_attributes.is_a?(Hash)
@env = Env.new(new_attributes["env"])
@cache = Cache.new(new_attributes["cache"])
@artifacts = Artifacts.new(new_attributes["artifacts"])
@deploy = Deploy.new(new_attributes["deploy"])
@matrix_attributes = matrix_attributes
build_attributes new_attributes
end
|
Instance Attribute Details
#artifacts ⇒ Object
Returns the value of attribute artifacts.
41
42
43
|
# File 'lib/vx/builder/build_configuration.rb', line 41
def artifacts
@artifacts
end
|
#cache ⇒ Object
Returns the value of attribute cache.
41
42
43
|
# File 'lib/vx/builder/build_configuration.rb', line 41
def cache
@cache
end
|
#deploy ⇒ Object
Returns the value of attribute deploy.
41
42
43
|
# File 'lib/vx/builder/build_configuration.rb', line 41
def deploy
@deploy
end
|
#env ⇒ Object
Returns the value of attribute env.
41
42
43
|
# File 'lib/vx/builder/build_configuration.rb', line 41
def env
@env
end
|
Class Method Details
.from_file(file) ⇒ Object
34
35
36
37
38
|
# File 'lib/vx/builder/build_configuration.rb', line 34
def from_file(file)
if File.readable? file
from_yaml File.read(file)
end
end
|
.from_yaml(yaml) ⇒ Object
29
30
31
32
|
# File 'lib/vx/builder/build_configuration.rb', line 29
def from_yaml(yaml)
hash = YAML.load(yaml)
new hash
end
|
Instance Method Details
#cached_directories ⇒ Object
97
98
99
|
# File 'lib/vx/builder/build_configuration.rb', line 97
def cached_directories
@cache.enabled? and @cache.directories
end
|
#deploy? ⇒ Boolean
69
70
71
|
# File 'lib/vx/builder/build_configuration.rb', line 69
def deploy?
!deploy.attributes.empty?
end
|
#env_matrix ⇒ Object
89
90
91
|
# File 'lib/vx/builder/build_configuration.rb', line 89
def env_matrix
env.matrix
end
|
#language ⇒ Object
93
94
95
|
# File 'lib/vx/builder/build_configuration.rb', line 93
def language
@attributes["language"].first
end
|
#matrix_attributes ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/vx/builder/build_configuration.rb', line 56
def matrix_attributes
@matrix_attributes.inject({}) do |a,pair|
k,v = pair
if k == 'env'
v = v["matrix"].first
end
if v
a[k] = v
end
a
end
end
|
#matrix_id ⇒ Object
74
75
76
|
# File 'lib/vx/builder/build_configuration.rb', line 74
def matrix_id
matrix_attributes.to_a.map{|i| i.join(":") }.sort.join(", ")
end
|
#to_hash ⇒ Object
78
79
80
81
82
83
|
# File 'lib/vx/builder/build_configuration.rb', line 78
def to_hash
attributes.merge("env" => env.attributes)
.merge("cache" => cache.attributes)
.merge("artifacts" => artifacts.attributes)
.merge("deploy" => deploy.attributes)
end
|
#to_yaml ⇒ Object
85
86
87
|
# File 'lib/vx/builder/build_configuration.rb', line 85
def to_yaml
to_hash.to_yaml
end
|