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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b01cd8a132faf22ac64d8ae7108b7f65e2cbe8e6
4
- data.tar.gz: bb2d6983b7d3f3bdacf5317a85a9e81eb66874eb
3
+ metadata.gz: 19fed2245b7bc6158415420d22e10d41c231458f
4
+ data.tar.gz: fb2349baa6c1d91af563a1dd97976dbbbbd4ff2d
5
5
  SHA512:
6
- metadata.gz: 78f08dfcfa31ebe767d5f7920a31f062f16bbadffce7baffb51fb8fe493f00e33ed4aacf15c14fec916b8c5e21e736c8842fd2115ab1819fd8a28f84a981b9f7
7
- data.tar.gz: a1436dace186cfa10a075cc7856e219dc05beeb4cd715f79a3201a441f90cfcb005aad2a937ca72c023f0752c04aaa443cb55114fe67437c7227be15005ab316
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
  )
@@ -85,6 +85,10 @@ module Vx
85
85
  a.join("\n")
86
86
  end
87
87
 
88
+ def vexor
89
+ source.vexor
90
+ end
91
+
88
92
  private
89
93
 
90
94
  def env
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module Builder
3
- VERSION = "0.3.4"
3
+ VERSION = "0.3.5"
4
4
  end
5
5
  end
@@ -0,0 +1 @@
1
+ language: ruby
@@ -37,3 +37,7 @@ after_deploy: echo after deploy
37
37
  before_deploy: echo before deploy
38
38
 
39
39
  bundler_args: --without development
40
+
41
+ vexor:
42
+ timeout: 10
43
+ read_timeout: 20
@@ -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"],
@@ -79,7 +79,8 @@ describe Vx::Builder::MatrixBuilder do
79
79
  "directories" => [],
80
80
  "enabled" => true
81
81
  },
82
- "script" => ["/bin/true"]
82
+ "script" => ["/bin/true"],
83
+ "vexor" => {"timeout"=>nil, "read_timeout"=>nil}
83
84
  ) }
84
85
  end
85
86
  end
@@ -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
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-18 00:00:00.000000000 Z
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