dry-stack 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36f7715c78b55d4cdb925f8546caf29c3f14f4a91226307ea9b2e2a49195101a
4
- data.tar.gz: 00e3171fa38e008d72a9d397fe5225dd7b15ce76add02dcfb4eb85c1061d365d
3
+ metadata.gz: 8b7592331dd36eea2532e592b77b79cbfd7e63c3f629d585711c94b028269fe2
4
+ data.tar.gz: 2b7728492289f69ec986471cdc5782930c1f060d408dc449b2c4bf6b7017f970
5
5
  SHA512:
6
- metadata.gz: 8e99e81d6a8bc9a23f0a5ab603d667967d16affc9ac3d0fa8b35497f03297d877f41f991f8604f5ccb0193e0e18d27cf6c128705ae9a00cdacc243769899a4c7
7
- data.tar.gz: d41dd16da3b445009adc06cca9e654eb0bf7249ce3d033326939c36fd54afded2e3f6707bd844b6961eec4cd375ad5da26f6958fd1a9d0753f8c1f543ca1a652
6
+ metadata.gz: 9c13514eb9ca9b88f12b244cd501e207cc6a641e9a6e5dd12d12268c4685c4adc9b8eed2219d3488d45d0cfed8704b817c62ab969bdbf8861c5f382f359ba10c
7
+ data.tar.gz: e3100351c69491951e4ddd949f9b21d3bdf817fc3ebc5b7248e95064db9b97ed113ae4ca9c19509e084d97e247f434dd7685b56f031131373acd700d09948353
@@ -38,7 +38,10 @@ module Dry
38
38
  end
39
39
 
40
40
  def safe_eval(drs, params)
41
- Dry::Stack(params[:name], params[:configuration]) { eval drs, self.binding }
41
+ Dry::Stack(params[:name], params[:configuration]) do
42
+ eval drs, self.binding
43
+ @after_blocks&.each { instance_exec &_1 }
44
+ end
42
45
  end
43
46
 
44
47
  def run(args)
@@ -82,6 +85,9 @@ module Dry
82
85
 
83
86
  params.transform_keys!{_1.to_s.gsub('-','_').to_sym}
84
87
  params[:traefik_tls] = true if params[:tls_domain]
88
+ params[:traefik] = true unless params.key? :traefik
89
+
90
+ Dry.cmd_params = params
85
91
 
86
92
  raise 'Stack file not defined' if $stdin.tty? && !params[:stack]
87
93
 
@@ -39,6 +39,9 @@ module Dry
39
39
  end
40
40
  end
41
41
 
42
+ attr_accessor :cmd_params
43
+ @cmd_params = {}
44
+
42
45
  def Stack(name = nil, configuration = nil, &)
43
46
  Stack.last_stack = Stack.new name
44
47
  Stack.last_stack.instance_exec(&) if block_given?
@@ -303,6 +306,15 @@ module Dry
303
306
  JSON.parse(compose.to_json).to_yaml
304
307
  end
305
308
 
309
+ def Include(file_name)
310
+ dir = Dry.cmd_params[:stack] ? File.dirname(Dry.cmd_params[:stack]) : '.'
311
+ eval IO.read( File.join dir, file_name )
312
+ end
313
+
314
+ def After(&block)
315
+ (@after_blocks ||=[]) << block
316
+ end
317
+
306
318
  def PublishPorts(ports)
307
319
  @publish_ports.merge! ports.to_h { |k, v| [k,[v].flatten] }
308
320
  end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  class Stack
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.6'
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.4
4
+ version: 0.1.6
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-07-28 00:00:00.000000000 Z
11
+ date: 2024-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake