orchparty 1.2.0 → 1.2.1

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: 7f74508ff820e0b932d58aae5d6c8b3cfc41aa5e
4
- data.tar.gz: d3043e2090e4558b10143b3c6a1f610725e17a43
3
+ metadata.gz: c5188728e716189c344e9a6d288670cc23be351f
4
+ data.tar.gz: 8f4f7ef1c744668761b7870c219b84c02f6752dc
5
5
  SHA512:
6
- metadata.gz: 6077deb22a2937260918f0cd91e909c2afd47a04f4ac119f22ff2cd0213bc66d2e488ff25cd17ebfd2aa399a3c9e2cb5e5122a30e8150c20fee1d7c806999f4a
7
- data.tar.gz: 7f9796ec7cab612a71c7519800077bd093d61a75e80d360957493eda79b9c677abcc4136eab94f4bbeafef58780616680b8f50645729d33740d5de866875b608
6
+ metadata.gz: 1318dcccb4853a0b4e100ff5b6d55aa7977d4225c9d739148dd3e75a9fda962d451406b8ad9ce112f87062c2a173536cac7e64976ac1d684a5c2f79fdf13c255
7
+ data.tar.gz: 7d8457abe046d21f86392d7ecd37a62ffd4bc7ee3a8f9df291e5293cce4abd5a430169727297aa7b0159781584d2014be3450bafcb4d1200fbd8188142c47d38
@@ -9,24 +9,31 @@ module Orchparty
9
9
  def transform(ast)
10
10
  ast.applications.each do |_, application|
11
11
  application.services = application.services.each do |_, service|
12
- service.deep_transform_values! do |v|
12
+ resolve(application, service, service)
13
+ end
14
+ application.volumes = application.volumes.each do |_, volume|
15
+ resolve(application, volume, nil) if volume
16
+ end
17
+ end
18
+ ast
19
+ end
20
+
21
+ def resolve(application, subject, service)
22
+ subject.deep_transform_values! do |v|
23
+ if v.respond_to?(:call)
24
+ eval_value(build_context(application: application, service: service), v)
25
+ elsif v.is_a? Array
26
+ v.map do |v|
13
27
  if v.respond_to?(:call)
14
28
  eval_value(build_context(application: application, service: service), v)
15
- elsif v.is_a? Array
16
- v.map do |v|
17
- if v.respond_to?(:call)
18
- eval_value(build_context(application: application, service: service), v)
19
- else
20
- v
21
- end
22
- end
23
29
  else
24
30
  v
25
31
  end
26
32
  end
33
+ else
34
+ v
27
35
  end
28
36
  end
29
- ast
30
37
  end
31
38
 
32
39
  def eval_value(context, value)
@@ -34,9 +41,13 @@ module Orchparty
34
41
  end
35
42
 
36
43
  def build_context(application:, service:)
37
- application._variables ||= {}
38
- variables = application._variables.merge(service._variables)
39
- context = Context.new(variables.merge({application: application.merge(application._variables), service: service.merge(service._variables)}))
44
+ variables = application._variables || {}
45
+ variables = variables.merge({application: application.merge(application._variables)})
46
+ if service
47
+ variables = variables.merge(service._variables)
48
+ variables = variables.merge({service: service.merge(service._variables)})
49
+ end
50
+ context = Context.new(variables)
40
51
  context._force_variable_definition = @force_variable_definition
41
52
  context
42
53
  end
@@ -1,3 +1,3 @@
1
1
  module Orchparty
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orchparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jannis Huebl
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-29 00:00:00.000000000 Z
11
+ date: 2017-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie