vx-builder 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vx/builder/build_configuration/deploy/base.rb +13 -1
- data/lib/vx/builder/build_configuration/deploy.rb +17 -0
- data/lib/vx/builder/build_configuration.rb +1 -0
- data/lib/vx/builder/deploy_builder.rb +2 -1
- data/lib/vx/builder/version.rb +1 -1
- data/spec/lib/builder/build_configuration/deploy/base_spec.rb +7 -0
- data/spec/lib/builder/build_configuration/deploy_spec.rb +11 -0
- data/spec/lib/builder/build_configuration_spec.rb +12 -0
- data/spec/lib/builder/deploy_builder_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45791c5eb7d09805bf54688cf7bad24381933750
|
4
|
+
data.tar.gz: 5d42c9ee4247cb9f94d2f8b884c8b9653d964082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e43c8093cfe287c48236efe385063aa39b8740bfe1a4d0d8322c1255144af1335a87442e864eed7e4fdb23aa5fec4659cad6fb2dd3fc33b972ba1463cd9a6a8
|
7
|
+
data.tar.gz: ddcdb655878e2c165998d85ca057588e12b74e7048c7051e87513470a35f8a1726d0e657884f284ca424e63a1e2a31d48051915ecfced74619b72ecfa879d822
|
@@ -25,6 +25,10 @@ module Vx
|
|
25
25
|
def detect(params)
|
26
26
|
params.key?(key.to_s) if key
|
27
27
|
end
|
28
|
+
|
29
|
+
def module_by_key(val)
|
30
|
+
loaded.find{|i| i.key.to_s == val.to_s }
|
31
|
+
end
|
28
32
|
end
|
29
33
|
|
30
34
|
attr_reader :params, :branch
|
@@ -48,7 +52,15 @@ module Vx
|
|
48
52
|
|
49
53
|
def key
|
50
54
|
if self.class.key
|
51
|
-
Array(params[self.class.key.to_s])
|
55
|
+
@key ||= Array(params[self.class.key.to_s])
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_hash
|
60
|
+
if key
|
61
|
+
{ self.class.key.to_s => key }
|
62
|
+
else
|
63
|
+
{}
|
52
64
|
end
|
53
65
|
end
|
54
66
|
|
@@ -3,6 +3,18 @@ module Vx
|
|
3
3
|
class BuildConfiguration
|
4
4
|
class Deploy
|
5
5
|
|
6
|
+
class << self
|
7
|
+
def restore_modules(values)
|
8
|
+
(values || []).inject([]) do |ac, pair|
|
9
|
+
k = pair.keys.first
|
10
|
+
if it = Base.module_by_key(k)
|
11
|
+
ac << it.new(pair)
|
12
|
+
end
|
13
|
+
ac
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
6
18
|
attr_reader :attributes
|
7
19
|
|
8
20
|
def initialize(new_env)
|
@@ -13,8 +25,13 @@ module Vx
|
|
13
25
|
@attributes
|
14
26
|
end
|
15
27
|
|
28
|
+
def empty?
|
29
|
+
attributes.empty?
|
30
|
+
end
|
31
|
+
|
16
32
|
def find_modules(branch)
|
17
33
|
modules = []
|
34
|
+
|
18
35
|
Base.loaded.each do |l|
|
19
36
|
attributes.each do |attr|
|
20
37
|
if l.detect(attr)
|
@@ -50,6 +50,7 @@ module Vx
|
|
50
50
|
@cache = Cache.new new_attributes.delete("cache")
|
51
51
|
@deploy = Deploy.new new_attributes.delete("deploy")
|
52
52
|
@deploy_modules = new_attributes.delete("deploy_modules") || []
|
53
|
+
@deploy_modules = Deploy.restore_modules(@deploy_modules)
|
53
54
|
|
54
55
|
@matrix_attributes = matrix_attributes
|
55
56
|
|
@@ -7,6 +7,7 @@ module Vx
|
|
7
7
|
before_script
|
8
8
|
after_success
|
9
9
|
script
|
10
|
+
deploy_modules
|
10
11
|
}
|
11
12
|
|
12
13
|
attr_reader :base_build_configuration, :matrix_build_configuration, :branch
|
@@ -31,7 +32,7 @@ module Vx
|
|
31
32
|
|
32
33
|
BuildConfiguration.new(
|
33
34
|
hash.merge(
|
34
|
-
"deploy_modules" => deploy_modules,
|
35
|
+
"deploy_modules" => deploy_modules.map(&:to_hash),
|
35
36
|
"deploy" => nil
|
36
37
|
)
|
37
38
|
)
|
data/lib/vx/builder/version.rb
CHANGED
@@ -30,4 +30,11 @@ describe Vx::Builder::BuildConfiguration::Deploy::Base do
|
|
30
30
|
it { should have(1).items }
|
31
31
|
end
|
32
32
|
|
33
|
+
context ".module_by_key" do
|
34
|
+
it "should find modules" do
|
35
|
+
expect(described_class.module_by_key :shell).to eq Vx::Builder::BuildConfiguration::Deploy::Shell
|
36
|
+
expect(described_class.module_by_key :not_shell).to be_nil
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
33
40
|
end
|
@@ -47,4 +47,15 @@ describe Vx::Builder::BuildConfiguration::Deploy do
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
context "restore_modules" do
|
51
|
+
let(:attrs) { [
|
52
|
+
{ "shell" => "/bin/true" }
|
53
|
+
] }
|
54
|
+
it "should build deploy module instances" do
|
55
|
+
list = described_class.restore_modules(attrs)
|
56
|
+
expect(list).to have(1).item
|
57
|
+
expect(list.first).to be_an_instance_of(Vx::Builder::BuildConfiguration::Deploy::Shell)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
50
61
|
end
|
@@ -65,4 +65,16 @@ describe Vx::Builder::BuildConfiguration do
|
|
65
65
|
subject { config.deploy }
|
66
66
|
it { should be }
|
67
67
|
end
|
68
|
+
|
69
|
+
context "deploy_modules" do
|
70
|
+
let(:content) { {
|
71
|
+
"deploy_modules" => [
|
72
|
+
{ "shell" => "/bin/true" }
|
73
|
+
]
|
74
|
+
} }
|
75
|
+
it "should restore" do
|
76
|
+
expect(config).to have(1).deploy_modules
|
77
|
+
expect(config).to be_deploy_modules
|
78
|
+
end
|
79
|
+
end
|
68
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vx-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Galinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vx-common
|