vx-builder 0.3.7 → 0.3.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3068ec11992c3b9bdabd2d4eb6ced778b23151d8
4
- data.tar.gz: 6da22dba6cbf630e9c222885debf8c5b331cb152
3
+ metadata.gz: b7e243037d06ddcd7813166b70df4888db8100f7
4
+ data.tar.gz: e7528036e2fd80872a80ec530b31dc17e227393a
5
5
  SHA512:
6
- metadata.gz: c047a1082e15e900f199222b642beb0dffdfe5c1f9b1ebbbff3982078c6825bf18fc1e1c604007841d619858c0149b36c43557fcdd5997cf027b692aa3127aef
7
- data.tar.gz: 96118b65e5d3e14344f9dce70a3f67aa96555c7ac0c8e97328f1c41bd3df03d67b77231f6c2e89aeaa62607afaaa49cdcdd0316ef94469ac61c971a8a7f3b469
6
+ metadata.gz: 3c36922c4cbd5ab2d91994b1b211341d3fe030b2741387bff9e42e2f36c783b24e52e07111cd18adbcf11fedbd4faaa2407025b38e47a342d647e054655bec9a
7
+ data.tar.gz: 4f491e675307c9f892ce666dbe99e281c95a77ccb03fd63d7deac1592f671faa57f4fefafc8f6eab3d62f19ad00e6c056939fde3c743d94397f0ae858c015480
@@ -22,7 +22,6 @@ module Vx
22
22
  private
23
23
 
24
24
  def normalize_attributes(new_attributes)
25
-
26
25
  @attributes =
27
26
  case new_attributes
28
27
  when Hash
@@ -20,8 +20,10 @@ module Vx
20
20
  @build ||= begin
21
21
  new_attributes = build_configuration.to_hash.dup
22
22
  build_configurations = attributes_for_new_build_configurations_with_merged_env.map do |matrix_attributes|
23
- new_attributes.merge!(matrix_attributes)
24
- BuildConfiguration.new new_attributes, matrix_attributes
23
+ BuildConfiguration.new(
24
+ new_attributes.merge(matrix_attributes),
25
+ matrix_attributes
26
+ )
25
27
  end
26
28
  build_configurations.select{|bc| bc.any? }
27
29
  end
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module Builder
3
- VERSION = "0.3.7"
3
+ VERSION = "0.3.8"
4
4
  end
5
5
  end
@@ -34,7 +34,15 @@ describe Vx::Builder::MatrixBuilder do
34
34
 
35
35
  subject { matrix.build }
36
36
 
37
- it { should have(12).items }
37
+ def create_matrix(attrs = nil)
38
+ described_class.new(
39
+ Vx::Builder::BuildConfiguration.new(attrs || attributes)
40
+ ).build
41
+ end
42
+
43
+ it "should generate 12 configurations" do
44
+ expect(create_matrix).to have(12).items
45
+ end
38
46
 
39
47
  it "should copy script from source" do
40
48
  expect(subject.map(&:script).flatten).to eq ["echo script"] * 12
@@ -52,12 +60,14 @@ describe Vx::Builder::MatrixBuilder do
52
60
  expect(subject.map(&:matrix_attributes).flatten).to have(12).items
53
61
  end
54
62
 
55
- context "when empty configuration" do
56
- let(:attributes) { {
57
- "deploy" => "value"
58
- } }
63
+ it "should copy vexor attributes to all matrixes" do
64
+ m = create_matrix("vexor" => {"timeout" => 20}, "rvm" => %w{ 2.1 2.0 })
65
+ expect(m).to have(2).items
66
+ expect(m.map(&:vexor).map(&:timeout)).to eq [20, 20]
67
+ end
59
68
 
60
- it { should be_empty }
69
+ it "should be empty if configuration is empty" do
70
+ expect(create_matrix "deploy" => "value").to be_empty
61
71
  end
62
72
 
63
73
  context "without any matrix keys" do
@@ -65,23 +75,27 @@ describe Vx::Builder::MatrixBuilder do
65
75
  "script" => %w{ /bin/true },
66
76
  } }
67
77
 
68
- it { should have(1).item }
69
-
70
- context "attributes" do
71
- subject { matrix.build.first.to_hash.select{|k,v| !v.empty? } }
78
+ it "should have one configuration" do
79
+ expect(create_matrix).to have(1).item
80
+ end
72
81
 
73
- it { should eq(
82
+ it "should have valid attributes" do
83
+ m = create_matrix
84
+ m.map! do |c|
85
+ c.to_hash.select{ |k,v| !v.empty? }
86
+ end
87
+ expect(m).to eq([{
74
88
  "env" => {
75
- "matrix" => [],
76
- "global" => []
77
- },
89
+ "matrix" => [],
90
+ "global" => []
91
+ },
78
92
  "cache" => {
79
93
  "directories" => [],
80
94
  "enabled" => true
81
95
  },
82
96
  "script" => ["/bin/true"],
83
97
  "vexor" => {"timeout"=>nil, "read_timeout"=>nil}
84
- ) }
98
+ }])
85
99
  end
86
100
  end
87
101
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vx-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky