vx-builder 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vx/builder/build_configuration/vexor.rb +42 -0
- data/lib/vx/builder/build_configuration.rb +4 -1
- data/lib/vx/builder/script_builder.rb +4 -0
- data/lib/vx/builder/version.rb +1 -1
- data/spec/fixtures/simple.yml +1 -0
- data/spec/fixtures/travis.yml +4 -0
- data/spec/lib/builder/build_configuration/vexor_spec.rb +32 -0
- data/spec/lib/builder/build_configuration_spec.rb +1 -0
- data/spec/lib/builder/matrix_builder_spec.rb +2 -1
- data/spec/lib/builder/script_builder_spec.rb +13 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19fed2245b7bc6158415420d22e10d41c231458f
|
4
|
+
data.tar.gz: fb2349baa6c1d91af563a1dd97976dbbbbd4ff2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2568782780b71ce7ce9b49a35f731e2c53c2d52f5eee3a13a4131302257e77823bfc38d7d14ae28f44791ae274713ccbd8bebe1f009e885d9c61b312bbe11e5
|
7
|
+
data.tar.gz: d019a55de45647050061c7e9e4230e1b2cdb02e0d39196818c878aa729aa931189273b98ea3bd9087903166e051cd38c1462104c9c5b349f1c5c01a4cad9b609
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Vx
|
2
|
+
module Builder
|
3
|
+
class BuildConfiguration
|
4
|
+
class Vexor
|
5
|
+
|
6
|
+
attr_reader :attributes
|
7
|
+
|
8
|
+
def initialize(new_attributes)
|
9
|
+
normalize_attributes(new_attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
def timeout
|
13
|
+
tm = @attributes["timeout"].to_i
|
14
|
+
tm.to_i > 0 ? tm.to_i : nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def read_timeout
|
18
|
+
tm = @attributes["read_timeout"].to_i
|
19
|
+
tm.to_i > 0 ? tm.to_i : nil
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def normalize_attributes(new_attributes)
|
25
|
+
|
26
|
+
@attributes =
|
27
|
+
case new_attributes
|
28
|
+
when Hash
|
29
|
+
{
|
30
|
+
"timeout" => new_attributes["timeout"],
|
31
|
+
"read_timeout" => new_attributes["read_timeout"],
|
32
|
+
}
|
33
|
+
else
|
34
|
+
{}
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -49,13 +49,15 @@ module Vx
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
attr_reader :env, :cache, :deploy, :attributes, :deploy_modules
|
52
|
+
attr_reader :env, :cache, :deploy, :attributes, :deploy_modules, :vexor
|
53
53
|
|
54
54
|
def initialize(new_attributes = {}, matrix_attributes = {})
|
55
55
|
new_attributes = {} unless new_attributes.is_a?(Hash)
|
56
56
|
|
57
57
|
@env = Env.new new_attributes.delete("env")
|
58
58
|
@cache = Cache.new new_attributes.delete("cache")
|
59
|
+
@vexor = Vexor.new new_attributes.delete("vexor")
|
60
|
+
|
59
61
|
@deploy = Deploy.new new_attributes.delete("deploy")
|
60
62
|
@deploy_modules = new_attributes.delete("deploy_modules") || []
|
61
63
|
@deploy_modules = Deploy.restore_modules(@deploy_modules)
|
@@ -106,6 +108,7 @@ module Vx
|
|
106
108
|
attributes.merge(
|
107
109
|
"env" => env.attributes,
|
108
110
|
"cache" => cache.attributes,
|
111
|
+
"vexor" => vexor.attributes,
|
109
112
|
"deploy" => deploy.attributes,
|
110
113
|
"deploy_modules" => deploy_modules.map(&:to_hash)
|
111
114
|
)
|
data/lib/vx/builder/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
language: ruby
|
data/spec/fixtures/travis.yml
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Vx::Builder::BuildConfiguration::Vexor do
|
4
|
+
let(:params) { {
|
5
|
+
"timeout" => "1",
|
6
|
+
"read_timeout" => "2"
|
7
|
+
} }
|
8
|
+
let(:env) { described_class }
|
9
|
+
|
10
|
+
it "should successfuly normalize attributes" do
|
11
|
+
p = params
|
12
|
+
expect(env.new(p).timeout).to eq 1
|
13
|
+
expect(env.new(p).read_timeout).to eq 2
|
14
|
+
|
15
|
+
p = {}
|
16
|
+
expect(env.new(p).timeout).to be_nil
|
17
|
+
expect(env.new(p).read_timeout).to be_nil
|
18
|
+
|
19
|
+
p = nil
|
20
|
+
expect(env.new(p).timeout).to be_nil
|
21
|
+
expect(env.new(p).read_timeout).to be_nil
|
22
|
+
|
23
|
+
p = "foo"
|
24
|
+
expect(env.new(p).timeout).to be_nil
|
25
|
+
expect(env.new(p).read_timeout).to be_nil
|
26
|
+
|
27
|
+
p = %w{ foo }
|
28
|
+
expect(env.new(p).timeout).to be_nil
|
29
|
+
expect(env.new(p).read_timeout).to be_nil
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -43,6 +43,7 @@ describe Vx::Builder::BuildConfiguration do
|
|
43
43
|
"scala" => ['2.10.3'],
|
44
44
|
"script" => ["RAILS_ENV=test ls -1 && echo DONE!"],
|
45
45
|
"services" => ['rabbitmq'],
|
46
|
+
"vexor" => {"timeout"=>10, "read_timeout"=>20},
|
46
47
|
"deploy" => [{"shell"=>"cap deploy production"}],
|
47
48
|
"deploy_modules" => [],
|
48
49
|
"bundler_args" => ["--without development"],
|
@@ -16,6 +16,19 @@ describe Vx::Builder::ScriptBuilder do
|
|
16
16
|
it { should eq 'one' }
|
17
17
|
end
|
18
18
|
|
19
|
+
context "vexor" do
|
20
|
+
it "should avaialble timeout and read_timeout attributes" do
|
21
|
+
expect(script.vexor.timeout).to eq 10
|
22
|
+
expect(script.vexor.read_timeout).to eq 20
|
23
|
+
|
24
|
+
simple_source = create :source, name: "simple.yml"
|
25
|
+
simple_script = described_class.new task, simple_source
|
26
|
+
expect(simple_script.vexor.timeout).to be_nil
|
27
|
+
expect(simple_script.vexor.read_timeout).to be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
19
32
|
context "#to_before_script" do
|
20
33
|
subject { script.to_before_script }
|
21
34
|
it { should be }
|
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.5
|
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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vx-common
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- lib/vx/builder/build_configuration/deploy/base.rb
|
130
130
|
- lib/vx/builder/build_configuration/deploy/shell.rb
|
131
131
|
- lib/vx/builder/build_configuration/env.rb
|
132
|
+
- lib/vx/builder/build_configuration/vexor.rb
|
132
133
|
- lib/vx/builder/configuration.rb
|
133
134
|
- lib/vx/builder/deploy_builder.rb
|
134
135
|
- lib/vx/builder/helper/config.rb
|
@@ -168,6 +169,7 @@ files:
|
|
168
169
|
- spec/fixtures/integration/ruby/matrix/d.before_script.sh
|
169
170
|
- spec/fixtures/integration/ruby/matrix/d.script.sh
|
170
171
|
- spec/fixtures/scala.yml
|
172
|
+
- spec/fixtures/simple.yml
|
171
173
|
- spec/fixtures/travis.yml
|
172
174
|
- spec/fixtures/travis_bug_1.yml
|
173
175
|
- spec/fixtures/travis_bug_2.yml
|
@@ -177,6 +179,7 @@ files:
|
|
177
179
|
- spec/lib/builder/build_configuration/deploy/shell_spec.rb
|
178
180
|
- spec/lib/builder/build_configuration/deploy_spec.rb
|
179
181
|
- spec/lib/builder/build_configuration/env_spec.rb
|
182
|
+
- spec/lib/builder/build_configuration/vexor_spec.rb
|
180
183
|
- spec/lib/builder/build_configuration_spec.rb
|
181
184
|
- spec/lib/builder/configuration_spec.rb
|
182
185
|
- spec/lib/builder/deploy_builder_spec.rb
|
@@ -240,6 +243,7 @@ test_files:
|
|
240
243
|
- spec/fixtures/integration/ruby/matrix/d.before_script.sh
|
241
244
|
- spec/fixtures/integration/ruby/matrix/d.script.sh
|
242
245
|
- spec/fixtures/scala.yml
|
246
|
+
- spec/fixtures/simple.yml
|
243
247
|
- spec/fixtures/travis.yml
|
244
248
|
- spec/fixtures/travis_bug_1.yml
|
245
249
|
- spec/fixtures/travis_bug_2.yml
|
@@ -249,6 +253,7 @@ test_files:
|
|
249
253
|
- spec/lib/builder/build_configuration/deploy/shell_spec.rb
|
250
254
|
- spec/lib/builder/build_configuration/deploy_spec.rb
|
251
255
|
- spec/lib/builder/build_configuration/env_spec.rb
|
256
|
+
- spec/lib/builder/build_configuration/vexor_spec.rb
|
252
257
|
- spec/lib/builder/build_configuration_spec.rb
|
253
258
|
- spec/lib/builder/configuration_spec.rb
|
254
259
|
- spec/lib/builder/deploy_builder_spec.rb
|