dry-stack 0.0.42 → 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: 714c20df33f88d95128a5dc1d4b0126a880542b937c059f702b823c0fe27dc55
4
- data.tar.gz: 2d40875d2d0a06ca8ad7fe1dc9987d369cb0d9a4e425f15d24b15c8dcd37f98b
3
+ metadata.gz: 5ca6fc80ee4f5b70acdbd6e4d86b4cb5d5bf00883cc2e9fe0bc4e5c777cc5236
4
+ data.tar.gz: 7aa741e8b70f8d65ede1daca715d31b5e71ea50ee0ae0d68181124c6f1cd58a4
5
5
  SHA512:
6
- metadata.gz: 37303510f5a7573811b8256feb12341c2d7dd99a8b24b241291452b2022805a279b3743e8648bc824a2239167b9fe7ef2de09cb905601e38e07bd244aa606e66
7
- data.tar.gz: 1c1278f09fb97c632c4f6912a110ff879727cef83a76fc6c3d5aa4569278ebc188af1361a4df399c41d039f135a57c5727fb0e7081637510182a45e52ad2ce6c
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?
@@ -161,7 +164,17 @@ module Dry
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?
163
166
 
164
- service[:environment].transform_values!{ !!_1 == _1 ? _1.to_s : _1 } # false | true to string
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
165
178
  end
166
179
 
167
180
  prune = ->(o) {
@@ -189,6 +202,10 @@ module Dry
189
202
  @description = string
190
203
  end
191
204
 
205
+ def Config(name, opts)
206
+ @configs[name] = opts
207
+ end
208
+
192
209
  def Options(opts)
193
210
  warn 'WARN: Options command is used for testing purpose.\
194
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.42'
3
+ VERSION = '0.0.43'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.42
4
+ version: 0.0.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B