vx-builder 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7998b25a579c3f0454f0d8570e430a8160b277dd
4
- data.tar.gz: 4db82b2386a234a21847bc238d246a7ee6a7b323
3
+ metadata.gz: 5dfe8821a2dbcc3ee1ffcaab8735c41bafacd2b4
4
+ data.tar.gz: 570fe0d7926a01cb815cfb17f96ceae9a7f5598a
5
5
  SHA512:
6
- metadata.gz: 8092cff129181614b6c7508116de77fe34a48f52a8b09750b9958ceefb31a08710fe7255fcf5c205f3453af8e95db95e50f274130cdbab2be9c7e01be71eaea4
7
- data.tar.gz: 84308df7403a76e3ba6da6782912dae15988a8c85a5ab76cc7f0392c4b36948c47ec6848ffcd83607035d8432734fb3cd6f2c6c4fa13b8385cb86e66af34ac48
6
+ metadata.gz: 394f85a75f76e416b51aa311b0a3425bca20733e354cd26b6388a54c0e13311eaaef8992b2ebdfd6d0d7f47f8382ad6423de643051fe98d10f8f8ad701e86c1e
7
+ data.tar.gz: 330d274952a14f064cae171fa88586d6b915223ce3be5b9231a893e72a889aa0fcb929f2b4e0415d22aa792a89d719e373e2330b0444e5d1b09676050a8bd192
@@ -8,6 +8,14 @@ module Vx
8
8
  module Builder
9
9
  class BuildConfiguration
10
10
 
11
+ REQUIRED_KEYS = %w{
12
+ rvm
13
+ scala
14
+ jdk
15
+ language
16
+ script
17
+ }
18
+
11
19
  ATTRIBUTES = %w{
12
20
  rvm
13
21
  scala
@@ -57,6 +65,12 @@ module Vx
57
65
  build_attributes new_attributes
58
66
  end
59
67
 
68
+ def any?
69
+ REQUIRED_KEYS.any? do |key|
70
+ attributes[key].any?
71
+ end
72
+ end
73
+
60
74
  def matrix_attributes
61
75
  @matrix_attributes.inject({}) do |a,pair|
62
76
  k,v = pair
@@ -14,7 +14,7 @@ module Vx
14
14
 
15
15
  def initialize(matrix_builder, options = {})
16
16
  @base_build_configuration = matrix_builder.build_configuration
17
- @matrix_build_configuration = matrix_builder.build.first
17
+ @matrix_build_configuration = matrix_builder.build.first || matrix_builder.build_configuration
18
18
  @branch = options[:branch]
19
19
  end
20
20
 
@@ -19,10 +19,11 @@ module Vx
19
19
  def build
20
20
  @build ||= begin
21
21
  new_attributes = build_configuration.to_hash.dup
22
- attributes_for_new_build_configurations_with_merged_env.map do |matrix_attributes|
22
+ build_configurations = attributes_for_new_build_configurations_with_merged_env.map do |matrix_attributes|
23
23
  new_attributes.merge!(matrix_attributes)
24
24
  BuildConfiguration.new new_attributes, matrix_attributes
25
25
  end
26
+ build_configurations.select{|bc| bc.any? }
26
27
  end
27
28
  end
28
29
 
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module Builder
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
@@ -78,4 +78,24 @@ describe Vx::Builder::BuildConfiguration do
78
78
  expect(config).to be_deploy_modules
79
79
  end
80
80
  end
81
+
82
+ context "any?" do
83
+ subject { config.any? }
84
+ %w{ rvm scala jdk language script }.each do |required_key|
85
+ context "when key #{required_key} exists" do
86
+ let(:content) { {
87
+ required_key => "value"
88
+ } }
89
+ it { should be }
90
+ end
91
+ end
92
+
93
+ context "when required keys does not exists" do
94
+ let(:content) { {
95
+ "before_script" => "value",
96
+ "deploy" => "value"
97
+ } }
98
+ it { should_not be }
99
+ end
100
+ end
81
101
  end
@@ -61,6 +61,20 @@ describe Vx::Builder::DeployBuilder do
61
61
  expect(config.first).to be_deploy_modules
62
62
  end
63
63
 
64
+ it "should create build_configurations when matrix_build_configurations is empty" do
65
+ empty_config = Vx::Builder::BuildConfiguration.new("before_install" => "value", "deploy" => { "shell" => "value" })
66
+ matrix = Vx::Builder.matrix empty_config
67
+ deploy = Vx::Builder.deploy matrix
68
+ config = deploy.build
69
+
70
+ expect(matrix.build).to be_empty
71
+
72
+ expect(config).to have(1).item
73
+ expect(config.first).to_not be_deploy
74
+ expect(config.first).to be_deploy_modules
75
+ expect(config.first.before_install).to eq ["value"]
76
+ end
77
+
64
78
  it "should be empty if not valid" do
65
79
  deploy = described_class.new matrix, branch: "production"
66
80
  expect(deploy.build).to be_empty
@@ -48,6 +48,14 @@ describe Vx::Builder::MatrixBuilder do
48
48
  expect(subject.map(&:before_install).flatten).to eq ["echo before_install"] * 12
49
49
  end
50
50
 
51
+ context "when empty configuration" do
52
+ let(:attributes) { {
53
+ "deploy" => "value"
54
+ } }
55
+
56
+ it { should be_empty }
57
+ end
58
+
51
59
  context "without any matrix keys" do
52
60
  let(:attributes) { {
53
61
  "script" => %w{ /bin/true },
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.2
4
+ version: 0.3.3
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-14 00:00:00.000000000 Z
11
+ date: 2014-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vx-common