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:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b7e243037d06ddcd7813166b70df4888db8100f7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e7528036e2fd80872a80ec530b31dc17e227393a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3c36922c4cbd5ab2d91994b1b211341d3fe030b2741387bff9e42e2f36c783b24e52e07111cd18adbcf11fedbd4faaa2407025b38e47a342d647e054655bec9a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4f491e675307c9f892ce666dbe99e281c95a77ccb03fd63d7deac1592f671faa57f4fefafc8f6eab3d62f19ad00e6c056939fde3c743d94397f0ae858c015480
         
     | 
| 
         @@ -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 
     | 
    
         
            -
                         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 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
         
     | 
    
        data/lib/vx/builder/version.rb
    CHANGED
    
    
| 
         @@ -34,7 +34,15 @@ describe Vx::Builder::MatrixBuilder do 
     | 
|
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                subject { matrix.build }
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
                 
     | 
| 
      
 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 
     | 
    
         
            -
                 
     | 
| 
       56 
     | 
    
         
            -
                   
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       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 
     | 
    
         
            -
             
     | 
| 
      
 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  
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                   
     | 
| 
       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 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       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 
     | 
    
         |