orchparty 2.0.1 → 2.0.2

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
  SHA256:
3
- metadata.gz: 0075cb8447ce75f61e92582d35ed9fe7120585ce37cbbdf4ee58fdbee68f9473
4
- data.tar.gz: cbe9479f0ef089251e9081ac533bdc27ba3eb132a407e2607b5879662ef081dc
3
+ metadata.gz: '094942f103771b85c3ddb7268baecd6c4b70becc95c78650052ef3a35ce37db7'
4
+ data.tar.gz: 8d0bdaf761f6715801ecfce8663688e2cabad6e58c1584db9a2fd8c3d1154934
5
5
  SHA512:
6
- metadata.gz: 462b73368c8bbc35d37aac8d6d5191dd0c299574a177da2cff378895c1e8e50d097272185aacdc2de077283b8efb9c070a8f81cb0df61caf2bd413c20c41fbad
7
- data.tar.gz: bf159109f6bbb30e68a322a10537a211109b6fa307808e4371a4e5faf4f5cfdb3893ebfa86b6d000614c3e45aa36093eb2b5a6486b5ab1a5ba9cd219330f1891
6
+ metadata.gz: 68afad75c4294c80f6730835d554824679dd8151c0269abc35d8c0e8c4343ddb13f40d7d5575edd915d05dac7ceecbcbcf090acd0d5f44557d5d4c4fc95c7537
7
+ data.tar.gz: 1e527f6cccb2b8b352f6885a112113f14c0d526ec1393eae3ae75008aebbf4cb5382ca5c14bc5010d1c3a945ac8eeb98ef7ef9c99cd9fe4b825f16417f0451d1
@@ -8,24 +8,27 @@ module Orchparty
8
8
 
9
9
  def transform(ast)
10
10
  ast.applications.each do |_, application|
11
+ app_variables = application._variables || {}
12
+ app_variables = app_variables.merge({application: application.merge(application._variables)})
11
13
  application.services = application.services.each do |_, service|
12
- resolve(application, service, service)
14
+ resolve(app_variables, service, service)
13
15
  end
14
16
  application.volumes = application.volumes.each do |_, volume|
15
- resolve(application, volume, nil) if volume
17
+ resolve(app_variables, volume, nil) if volume
16
18
  end
17
19
  end
18
20
  ast
19
21
  end
20
22
 
21
- def resolve(application, subject, service)
23
+ def resolve(app_variables, subject, service)
24
+ context = build_context(app_variables, service)
22
25
  subject.deep_transform_values! do |v|
23
26
  if v.respond_to?(:call)
24
- eval_value(build_context(application: application, service: service), v)
27
+ eval_value(context, v)
25
28
  elsif v.is_a? Array
26
29
  v.map do |v|
27
30
  if v.respond_to?(:call)
28
- eval_value(build_context(application: application, service: service), v)
31
+ eval_value(context, v)
29
32
  else
30
33
  v
31
34
  end
@@ -40,12 +43,10 @@ module Orchparty
40
43
  context.instance_exec(&value)
41
44
  end
42
45
 
43
- def build_context(application:, service:)
44
- variables = application._variables || {}
45
- variables = variables.merge({application: application.merge(application._variables)})
46
+ def build_context(variables, service)
46
47
  if service
47
48
  variables = variables.merge(service._variables)
48
- variables = variables.merge({service: service.merge(service._variables)})
49
+ variables[:service] = service.merge(service._variables)
49
50
  end
50
51
  context = Context.new(variables)
51
52
  context._force_variable_definition = @force_variable_definition
@@ -1,3 +1,3 @@
1
1
  module Orchparty
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
data/orchparty.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency "gli", "~> 2.16.0"
29
29
  spec.add_dependency "activesupport"
30
30
  spec.add_dependency "erubis"
31
- spec.add_development_dependency "bundler"#, "~> 2.0.1"
32
- spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "bundler"
32
+ spec.add_development_dependency "rake", "~> 12.0"
33
33
  spec.add_development_dependency "rspec", "~> 3.0"
34
34
  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: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jannis Huebl
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-06 00:00:00.000000000 Z
11
+ date: 2022-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '10.0'
89
+ version: '12.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '10.0'
96
+ version: '12.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -157,7 +157,7 @@ homepage: https://orch.party
157
157
  licenses:
158
158
  - LGPL-3.0
159
159
  metadata: {}
160
- post_install_message:
160
+ post_install_message:
161
161
  rdoc_options: []
162
162
  require_paths:
163
163
  - lib
@@ -172,8 +172,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  requirements: []
175
- rubygems_version: 3.0.3
176
- signing_key:
175
+ rubygems_version: 3.1.4
176
+ signing_key:
177
177
  specification_version: 4
178
178
  summary: Write your orchestration configuration with a Ruby DSL that allows you to
179
179
  have mixins, imports and variables.