dry-stack 0.1.13 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dry-stack/stack.rb +13 -11
  3. data/lib/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54ac4c65eb9a540d8b78351dc5bdc4510034618928f212532fa18a18db143ac2
4
- data.tar.gz: cc6ccabf6a2a75b31236355012cfb033ce732f1b2379996aa519068ba95a51bd
3
+ metadata.gz: 1fdde5aef97bb0e9cd381fe8fb9191b7a4dcb3fcbb2a93daa8dc92dc09b7d8cd
4
+ data.tar.gz: d8205d27f505739e7dd7316170b98f2924c7cf700910ad5c5cf2e92376f68015
5
5
  SHA512:
6
- metadata.gz: 4873a1ff78e0ff316448b84d33d2dee65c928069b30a575dc45af76635884ee77de33dd8aa6178aff29e21d05cbd2dc35c488d21c4cc92ff71830414771bc2b0
7
- data.tar.gz: 8f85f6126686c34d6219dd8a21f50d8765d34fe1db4e9a4b6f753894d48bb5f0a609035dc9fd92b550d9df863b27948044ad081208d528435b9996c7977e1fdf
6
+ metadata.gz: '082bc6ed927bd5e5946c63faf531377fb3df998bafae31bd407a61256bf9a28166c78eb3b69a1e5988c6d1dec93405cc2c26a1feb6185f4d92b7261acad53748'
7
+ data.tar.gz: 7519e0d150a5dd434775ad88d249312d114c9229e3049c60d62f2cd8f9ba18f0889ad7929e6456bcf0851c207e80f37352f17cd36a1d0183d36eba72acc6b382
@@ -147,16 +147,16 @@ module Dry
147
147
  configs: YAML.load(@configs.to_yaml, aliases: true)
148
148
  }
149
149
 
150
- if @ingress.any?
151
- compose[:networks].merge! ingress_routing: {external: true, name: 'ingress-routing'}
152
- end
153
-
154
150
  compose[:services].each do |name, service|
155
151
 
156
152
  service[:image].gsub!(/:latest$/, '') if service[:image] # let docker swarm to create tag: :latest@sha265:0000...
157
153
 
158
154
  ingress = [@ingress[name], service[:ingress] || [] ].flatten.compact
159
155
 
156
+ if ingress.any?
157
+ compose[:networks].merge! ingress_routing: {external: true, name: 'ingress-routing'}
158
+ end
159
+
160
160
  service[:deploy] ||= {}
161
161
  service[:deploy][:labels] ||= []
162
162
  service[:deploy][:labels] += @labels.map { "#{_1}=#{_2}" }
@@ -231,13 +231,15 @@ module Dry
231
231
 
232
232
  service[:deploy].deep_merge! @deploy[name] if @deploy[name]
233
233
 
234
- hash = {'service-name': service_name, 'stack-name': @name}
235
- hash.default = ''
236
- original_verbosity = $VERBOSE
237
- $VERBOSE = nil
238
- service[:deploy][:labels] = service[:deploy][:labels].map{ _1 % hash }
239
- service[:environment].transform_values!{ _1.is_a?(String) ? (_1 % hash) : _1 }
240
- $VERBOSE = original_verbosity
234
+ # hash = {'service-name': service_name, 'stack-name': @name}
235
+ env_sub = ->(s) {
236
+ s = s.to_s.dup
237
+ s.gsub!('%{stack-name}', @name.to_s)
238
+ s.gsub!('%{service-name}', service_name)
239
+ s
240
+ }
241
+ service[:deploy][:labels] = service[:deploy][:labels].map{ env_sub[_1] }
242
+ service[:environment].transform_values!{ _1.is_a?(String) ? (env_sub[_1]) : _1 }
241
243
 
242
244
  pp_i = @publish_ports[name]&.reject { _1.class == String }
243
245
  pp_s = @publish_ports[name]&.select { _1.class == String }
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  class Stack
3
- VERSION = '0.1.13'
3
+ VERSION = '0.1.15'
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.1.13
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-21 00:00:00.000000000 Z
11
+ date: 2024-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake