vx-builder 0.3.1 → 0.3.2

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: 45791c5eb7d09805bf54688cf7bad24381933750
4
- data.tar.gz: 5d42c9ee4247cb9f94d2f8b884c8b9653d964082
3
+ metadata.gz: 7998b25a579c3f0454f0d8570e430a8160b277dd
4
+ data.tar.gz: 4db82b2386a234a21847bc238d246a7ee6a7b323
5
5
  SHA512:
6
- metadata.gz: 0e43c8093cfe287c48236efe385063aa39b8740bfe1a4d0d8322c1255144af1335a87442e864eed7e4fdb23aa5fec4659cad6fb2dd3fc33b972ba1463cd9a6a8
7
- data.tar.gz: ddcdb655878e2c165998d85ca057588e12b74e7048c7051e87513470a35f8a1726d0e657884f284ca424e63a1e2a31d48051915ecfced74619b72ecfa879d822
6
+ metadata.gz: 8092cff129181614b6c7508116de77fe34a48f52a8b09750b9958ceefb31a08710fe7255fcf5c205f3453af8e95db95e50f274130cdbab2be9c7e01be71eaea4
7
+ data.tar.gz: 84308df7403a76e3ba6da6782912dae15988a8c85a5ab76cc7f0392c4b36948c47ec6848ffcd83607035d8432734fb3cd6f2c6c4fa13b8385cb86e66af34ac48
@@ -43,7 +43,10 @@ module Vx
43
43
  end
44
44
 
45
45
  def branch?(name)
46
- if branch.empty?
46
+ case
47
+ when branch.empty?
48
+ true
49
+ when !name
47
50
  true
48
51
  else
49
52
  branch.include?(name)
@@ -84,9 +84,12 @@ module Vx
84
84
  end
85
85
 
86
86
  def to_hash
87
- attributes.merge("env" => env.attributes)
88
- .merge("cache" => cache.attributes)
89
- .merge("deploy" => deploy.attributes)
87
+ attributes.merge(
88
+ "env" => env.attributes,
89
+ "cache" => cache.attributes,
90
+ "deploy" => deploy.attributes,
91
+ "deploy_modules" => deploy_modules.map(&:to_hash)
92
+ )
90
93
  end
91
94
 
92
95
  def to_yaml
@@ -20,7 +20,7 @@ module Vx
20
20
 
21
21
  def build
22
22
  @build ||= begin
23
- return false unless valid?
23
+ return [] unless valid?
24
24
 
25
25
  hash = matrix_build_configuration.to_hash
26
26
 
@@ -30,12 +30,13 @@ module Vx
30
30
 
31
31
  hash["env"]["matrix"] = []
32
32
 
33
- BuildConfiguration.new(
33
+ build_configuration = BuildConfiguration.new(
34
34
  hash.merge(
35
35
  "deploy_modules" => deploy_modules.map(&:to_hash),
36
36
  "deploy" => nil
37
37
  )
38
38
  )
39
+ [build_configuration]
39
40
  end
40
41
  end
41
42
 
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module Builder
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -44,19 +44,22 @@ describe "(integration) ruby" do
44
44
  let(:config) { fixture("integration/ruby/deploy/config.yml") }
45
45
 
46
46
  context "configuration" do
47
- let(:task) { create :task, deploy: true }
48
- let(:source) { Vx::Builder.deploy(matrix, branch: "master").build }
49
- subject { script }
50
-
51
- before { write_script_to_filter "deploy/d." }
47
+ let(:task) { create :task, deploy: true }
48
+ let(:sources) { Vx::Builder.deploy(matrix, branch: "master").build }
52
49
 
53
50
  it "should have source" do
54
- expect(source).to be
51
+ expect(sources).to have(1).item
55
52
  end
56
53
 
57
- its(:to_before_script) { should eq fixture("integration/ruby/deploy/d.before_script.sh") }
58
- its(:to_script) { should eq fixture("integration/ruby/deploy/d.script.sh") }
59
- its(:to_after_script) { should eq fixture("integration/ruby/deploy/d.after_script.sh") }
54
+ context "first deploy configuration" do
55
+ let(:source) { sources.first }
56
+ before { write_script_to_filter "deploy/d." }
57
+ subject { script }
58
+
59
+ its(:to_before_script) { should eq fixture("integration/ruby/deploy/d.before_script.sh") }
60
+ its(:to_script) { should eq fixture("integration/ruby/deploy/d.script.sh") }
61
+ its(:to_after_script) { should eq fixture("integration/ruby/deploy/d.after_script.sh") }
62
+ end
60
63
  end
61
64
  end
62
65
 
@@ -88,20 +91,22 @@ describe "(integration) ruby" do
88
91
  end
89
92
 
90
93
  context "deploy configuration" do
91
- let(:task) { create :task }
92
- let(:source) { Vx::Builder.deploy(matrix, branch: "master").build }
93
- subject { script }
94
-
95
- before { write_script_to_filter "matrix/d." }
94
+ let(:task) { create :task }
95
+ let(:sources) { Vx::Builder.deploy(matrix, branch: "master").build }
96
96
 
97
97
  it "should have source" do
98
- expect(source).to be
98
+ expect(sources).to have(1).item
99
99
  end
100
100
 
101
- its(:to_before_script) { should eq fixture("integration/ruby/matrix/d.before_script.sh") }
102
- its(:to_script) { should eq fixture("integration/ruby/matrix/d.script.sh") }
103
- its(:to_after_script) { should eq fixture("integration/ruby/matrix/d.after_script.sh") }
101
+ context "first deploy configuration" do
102
+ let(:source) { sources.first }
103
+ subject { script }
104
+ before { write_script_to_filter "matrix/d." }
104
105
 
106
+ its(:to_before_script) { should eq fixture("integration/ruby/matrix/d.before_script.sh") }
107
+ its(:to_script) { should eq fixture("integration/ruby/matrix/d.script.sh") }
108
+ its(:to_after_script) { should eq fixture("integration/ruby/matrix/d.after_script.sh") }
109
+ end
105
110
  end
106
111
  end
107
112
  end
@@ -8,6 +8,7 @@ describe Vx::Builder::BuildConfiguration::Deploy::Base do
8
8
  subject { described_class.new params }
9
9
 
10
10
  context "#branch" do
11
+
11
12
  it "should be empty if key 'branch' is not exists" do
12
13
  expect(get_branch nil).to eq []
13
14
  end
@@ -44,6 +44,7 @@ describe Vx::Builder::BuildConfiguration do
44
44
  "script" => ["RAILS_ENV=test ls -1 && echo DONE!"],
45
45
  "services" => ['rabbitmq'],
46
46
  "deploy" => [{"shell"=>"cap deploy production"}],
47
+ "deploy_modules" => [],
47
48
  "bundler_args" => ["--without development"],
48
49
  "before_deploy" => ["echo before deploy"],
49
50
  "after_deploy" => ["echo after deploy"]
@@ -54,19 +54,20 @@ describe Vx::Builder::DeployBuilder do
54
54
 
55
55
  context "build" do
56
56
 
57
- it "should create build_configuration with deploy_modules and without deploy" do
58
- expect(deploy.build).to be
59
- expect(deploy.build).to_not be_deploy
60
- expect(deploy.build).to be_deploy_modules
57
+ it "should create build_configurations with deploy_modules and without deploy" do
58
+ config = deploy.build
59
+ expect(config).to have(1).item
60
+ expect(config.first).to_not be_deploy
61
+ expect(config.first).to be_deploy_modules
61
62
  end
62
63
 
63
- it "should be false if not valid" do
64
+ it "should be empty if not valid" do
64
65
  deploy = described_class.new matrix, branch: "production"
65
- expect(deploy.build).to be_false
66
+ expect(deploy.build).to be_empty
66
67
  end
67
68
 
68
69
  it "should remove attributes from BLACK_LIST" do
69
- config = deploy.build
70
+ config = deploy.build.first
70
71
  expect(config.image).to be_empty
71
72
  expect(config.before_script).to be_empty
72
73
  expect(config.script).to be_empty
@@ -75,7 +76,7 @@ describe Vx::Builder::DeployBuilder do
75
76
  end
76
77
 
77
78
  it "should remove matrix env" do
78
- config = deploy.build
79
+ config = deploy.build.first
79
80
  expect(config.env.global).to eq(['1'])
80
81
  expect(config.env.matrix).to eq([])
81
82
  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.1
4
+ version: 0.3.2
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-13 00:00:00.000000000 Z
11
+ date: 2014-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vx-common