dry-stack 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dry-stack/command_line.rb +0 -1
- data/lib/dry-stack/stack.rb +32 -6
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee77026f4dbbad4d93821303e117f494ca9ee63277d6ac75f9ee4bd4bf8f85f3
|
4
|
+
data.tar.gz: 115fd41b201a1483b0485639309e06f132f1247a7712f8c4a49ed26197ef3fa9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da8b13fa2ede538ad057ff761e5a66c9764e4c246581687bdafafbe6f7783fe036c3b1ff4580032a4fc103b4e2ff936a4001b62efa16b4be1342fb421ffb9969
|
7
|
+
data.tar.gz: 75fd19165a78349b402fd32c1a913c5b0697e833a448de9284e890657e7f9ea2c1aab94f281f877e6afcb51ada962c49eb485f88e0ea9941f265d2a94f0ff4fa
|
data/lib/dry-stack/stack.rb
CHANGED
@@ -45,6 +45,10 @@ module Dry
|
|
45
45
|
def Stack(name = nil, configuration = nil, &)
|
46
46
|
Stack.last_stack = Stack.new name
|
47
47
|
Stack.last_stack.instance_exec(&) if block_given?
|
48
|
+
Stack.last_stack.instance_exec do
|
49
|
+
@services_blocks&.each { instance_exec &_1 }
|
50
|
+
@after_blocks&.each { instance_exec &_1 }
|
51
|
+
end
|
48
52
|
Stack.last_stack.apply_configuration configuration if configuration
|
49
53
|
end
|
50
54
|
|
@@ -147,7 +151,7 @@ module Dry
|
|
147
151
|
|
148
152
|
compose[:services].each do |name, service|
|
149
153
|
|
150
|
-
service[:image].gsub!(/:latest$/, '') # let docker swarm to create tag: :latest@sha265:0000...
|
154
|
+
service[:image].gsub!(/:latest$/, '') if service[:image] # let docker swarm to create tag: :latest@sha265:0000...
|
151
155
|
|
152
156
|
ingress = [@ingress[name], service[:ingress] || [] ].flatten.compact
|
153
157
|
|
@@ -332,11 +336,19 @@ module Dry
|
|
332
336
|
(@after_blocks ||=[]) << block
|
333
337
|
end
|
334
338
|
|
335
|
-
def
|
339
|
+
def BeforeService(name = nil, opts = {}, &block)
|
340
|
+
(@before_blocks ||=[]).push names: [name].flatten.compact, except: opts[:except],
|
341
|
+
block: ->(s_name) {
|
342
|
+
_ServiceImplementation s_name, opts, &block
|
343
|
+
}
|
344
|
+
end
|
345
|
+
|
346
|
+
def AfterService(name = nil, opts = {}, &block)
|
336
347
|
After do
|
337
|
-
name
|
338
|
-
[
|
339
|
-
|
348
|
+
names = [name || @services.keys].flatten
|
349
|
+
names -= [opts[:except]].flatten if opts.key? :except
|
350
|
+
names.each do |s_name|
|
351
|
+
_ServiceImplementation s_name, opts, &block
|
340
352
|
end
|
341
353
|
end
|
342
354
|
end
|
@@ -345,7 +357,21 @@ module Dry
|
|
345
357
|
@publish_ports.merge! ports.to_h { |k, v| [k,[v].flatten] }
|
346
358
|
end
|
347
359
|
|
348
|
-
def Service(name, opts = {}, &)
|
360
|
+
def Service(name, opts = {}, &block)
|
361
|
+
@services_blocks ||=[]
|
362
|
+
(@services_blocks ||=[]).push -> { _ServiceDeferred(name, opts, &block) }
|
363
|
+
end
|
364
|
+
|
365
|
+
def _ServiceDeferred(name, opts = {}, &block)
|
366
|
+
(@before_blocks || []).each do |before|
|
367
|
+
next unless before[:names].empty? || before[:names].include?(name)
|
368
|
+
next if before[:except]&.include? name
|
369
|
+
before[:block].call(name)
|
370
|
+
end
|
371
|
+
_ServiceImplementation(name, opts, &block)
|
372
|
+
end
|
373
|
+
|
374
|
+
def _ServiceImplementation(name, opts = {}, &)
|
349
375
|
opts = opts.dup
|
350
376
|
opts[:ports] = [opts[:ports]].flatten if opts.key? :ports
|
351
377
|
opts[:environment] = opts.delete(:env) if opts.key? :env
|
data/lib/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.11
|
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-
|
11
|
+
date: 2024-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|