dry-stack 0.0.41 → 0.0.43

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
  SHA256:
3
- metadata.gz: ba3e8a1af6b73dab3938541b4e57ff3b4cd8a9cc745ce3a0376c218189b637c0
4
- data.tar.gz: c99d06063a7c31100aa58b7a8b1dc1bbabf5543aa45da1ed4e50a5b9d16c33ff
3
+ metadata.gz: 5ca6fc80ee4f5b70acdbd6e4d86b4cb5d5bf00883cc2e9fe0bc4e5c777cc5236
4
+ data.tar.gz: 7aa741e8b70f8d65ede1daca715d31b5e71ea50ee0ae0d68181124c6f1cd58a4
5
5
  SHA512:
6
- metadata.gz: 465baf756681438604e591107265a16b5f456ba8c92adfeec256d32abc8e8d162a23c658c0be1449b9b2b2f1f42f7d2f8603cdbc15ce6911a46c61afa63ae6ed
7
- data.tar.gz: 3b20f234381bf01bbcd95f7e65762473439074fee9665bc34443dff4b7e71d1c7df960187436070e18f02c6bccd84ee7c744ccc4f868ce4407a29a350dc01186
6
+ metadata.gz: e7b9609c0f091ce2c46d37b67763403f650b859d641f6c7c68f0eabf61bc73fba9a55530b800e47f41a74f088c8ff6ec9328f2a1747981182e09865a440d32f6
7
+ data.tar.gz: 8d85149f3fbbe7fadbbe93383af5b2f7b8885903ea6cf2d57ea77ded8cfa4bd150e4c9f5a6c9f1156c441fdad1244c58fb103673fd4a33932ba5b656a522f47d
@@ -18,6 +18,7 @@ module Dry
18
18
  def command(cmd)= @service[:command] = cmd
19
19
  def entrypoint(cmd)= @service[:entrypoint] = cmd
20
20
  def deploy_label(str)= @service[:deploy][:labels] << str
21
+ def config(name, opts)= (@service[:configs] ||= []) << {source: name.to_s }.merge(opts)
21
22
  end
22
23
 
23
24
  class Stack
@@ -44,6 +45,7 @@ module Dry
44
45
  @ingress = {}
45
46
  @deploy = {}
46
47
  @labels = {}
48
+ @configs = {}
47
49
  end
48
50
 
49
51
  def stringify(obj)
@@ -85,6 +87,7 @@ module Dry
85
87
  services: YAML.load(@services.to_yaml),
86
88
  volumes: YAML.load(@volumes.to_yaml),
87
89
  networks: YAML.load(@networks.to_yaml),
90
+ configs: YAML.load(@configs.to_yaml)
88
91
  }
89
92
 
90
93
  if @ingress.any?
@@ -160,6 +163,18 @@ module Dry
160
163
  pp_s = @publish_ports[name]&.select { _1.class == String }
161
164
  service[:ports] = pp_i&.zip(service[:ports] || pp_i)&.map { _1.join ':' }
162
165
  service[:ports] = (service[:ports] || []) + pp_s unless pp_s.nil?
166
+
167
+ service[:environment].transform_values! { !!_1 == _1 ? _1.to_s : _1 } # (false|true) to string
168
+ end
169
+
170
+ compose[:configs].update(compose[:configs]) do |name, config|
171
+ if config[:file_content]
172
+ fname = "./#{@name}.config.#{name}"
173
+ File.write fname, config[:file_content]
174
+ {file: fname}.merge config.except(:file_content)
175
+ else
176
+ config
177
+ end
163
178
  end
164
179
 
165
180
  prune = ->(o) {
@@ -187,6 +202,10 @@ module Dry
187
202
  @description = string
188
203
  end
189
204
 
205
+ def Config(name, opts)
206
+ @configs[name] = opts
207
+ end
208
+
190
209
  def Options(opts)
191
210
  warn 'WARN: Options command is used for testing purpose.\
192
211
  Not recommended in real life configurations.' unless $0 =~ /rspec/
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  class Stack
3
- VERSION = '0.0.41'
3
+ VERSION = '0.0.43'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.41
4
+ version: 0.0.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-16 00:00:00.000000000 Z
11
+ date: 2023-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake