dry-stack 0.1.4 → 0.1.5

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: 1cf8aa8cb9489eb7287cdf9c78c3c5c9da3f6d311ff6c949249af4e0f615a3b5
4
+ data.tar.gz: a7d0e07feac23d18478c8890b9f9934e657b4964feae95bbd1da1d26e208a1ec
5
5
  SHA512:
6
- metadata.gz: 8e99e81d6a8bc9a23f0a5ab603d667967d16affc9ac3d0fa8b35497f03297d877f41f991f8604f5ccb0193e0e18d27cf6c128705ae9a00cdacc243769899a4c7
7
- data.tar.gz: d41dd16da3b445009adc06cca9e654eb0bf7249ce3d033326939c36fd54afded2e3f6707bd844b6961eec4cd375ad5da26f6958fd1a9d0753f8c1f543ca1a652
6
+ metadata.gz: a68af80fb155c93aadd9031ae0e16d94debff2926f71e6ff1f643069815ee8fa52823c84e7348699bde8a348fdeba76e203d9812d0982fecef40be9d1d7d4704
7
+ data.tar.gz: fc170d04a11489ef3fc468f0621038909541de3a4187dfb9b3c55c3db895526e6b31c643a1c3879ec06c8db67483d244652c94b4e2f9886d01d725fce196f1be
@@ -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,7 @@ 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
+ Dry.cmd_params = params
85
89
 
86
90
  raise 'Stack file not defined' if $stdin.tty? && !params[:stack]
87
91
 
@@ -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.5'
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.5
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