orchparty 2.0.0 → 2.0.3

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: 371966e534d2370d5330bfe75cb313f497e33f93ce746619fb3435ccd4347bc5
4
- data.tar.gz: 15a76f2560f3103beb3152b2694a539f1e82c167ca671a67ad1239e665bd06ab
3
+ metadata.gz: 81cbf4dee8cf2042995f19b85c90e26f7f40eb73522901c6047fa5a6d0a57ce2
4
+ data.tar.gz: 8dfe9bfbcbd929b9be9e474e5766dee950e2fdd2dc0dc27e8035d10eebb24b69
5
5
  SHA512:
6
- metadata.gz: 2f4e1a007c640f44b86fac36f2593ebb1069cbef36302c910f4ca22b51c6fd21e187e7c713de15df8e9bf34f36a3bd288019a9011ac4bf27c8e1709bea4e1ce2
7
- data.tar.gz: 497d71938e78efe7bb70f465ab096e3823ea0fd4ea20ddbb25751adb352a6c5cd1c9c44aeb965f1e6545ae433c1a9b32c25afba9680fe959308bd5edf7c5a676
6
+ metadata.gz: 14d764436e9341c27d103ec925380b0bfc327c98a415dbbbb8f9f1b40ac841fa1de0a99ec8a755aa28c99229cc94dba78ed85376d04909f6a8ea0a0840108541
7
+ data.tar.gz: 5504256f032f38c2334958b1591dd5c51b063b4c27d597cd938eb06766c72eb12f6eb3a58bb831cb893ecd024feb57d526f7f8588a81674ec92c3236b4d667a3
@@ -2,7 +2,6 @@ require 'erb'
2
2
  require 'erubis'
3
3
  require 'open3'
4
4
  require 'ostruct'
5
- require 'byebug'
6
5
  require 'yaml'
7
6
  require 'tempfile'
8
7
  require 'active_support'
@@ -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.0"
2
+ VERSION = "2.0.3"
3
3
  end
data/orchparty.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  With this gem you can write docker-compose like orchestration configuration with a Ruby DSL, that supports mixins, imports and variables.!
15
15
  Out of this you can generate docker-compose.yml v1 or v2.
16
16
  EOF
17
- spec.homepage = "https://orch.party"
17
+ spec.homepage = "https://github.com/jannishuebl/orchparty"
18
18
  spec.license = "LGPL-3.0"
19
19
 
20
20
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -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.0
4
+ version: 2.0.3
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
@@ -153,11 +153,11 @@ files:
153
153
  - lib/orchparty/transformations/variable.rb
154
154
  - lib/orchparty/version.rb
155
155
  - orchparty.gemspec
156
- homepage: https://orch.party
156
+ homepage: https://github.com/jannishuebl/orchparty
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.