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 +4 -4
- data/lib/dry-stack/stack.rb +18 -1
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ca6fc80ee4f5b70acdbd6e4d86b4cb5d5bf00883cc2e9fe0bc4e5c777cc5236
|
4
|
+
data.tar.gz: 7aa741e8b70f8d65ede1daca715d31b5e71ea50ee0ae0d68181124c6f1cd58a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7b9609c0f091ce2c46d37b67763403f650b859d641f6c7c68f0eabf61bc73fba9a55530b800e47f41a74f088c8ff6ec9328f2a1747981182e09865a440d32f6
|
7
|
+
data.tar.gz: 8d85149f3fbbe7fadbbe93383af5b2f7b8885903ea6cf2d57ea77ded8cfa4bd150e4c9f5a6c9f1156c441fdad1244c58fb103673fd4a33932ba5b656a522f47d
|
data/lib/dry-stack/stack.rb
CHANGED
@@ -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
|
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