dry-stack 0.1.3 → 0.1.5
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 +5 -1
- data/lib/dry-stack/command_swarm_deploy.rb +3 -3
- data/lib/dry-stack/stack.rb +12 -0
- 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: 1cf8aa8cb9489eb7287cdf9c78c3c5c9da3f6d311ff6c949249af4e0f615a3b5
|
4
|
+
data.tar.gz: a7d0e07feac23d18478c8890b9f9934e657b4964feae95bbd1da1d26e208a1ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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])
|
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
|
|
@@ -9,10 +9,10 @@ Dry::CommandLine::COMMANDS[:swarm_deploy] = Class.new do
|
|
9
9
|
_params = stack.options.merge params
|
10
10
|
stack.name = _params[:name] if _params[:name]
|
11
11
|
|
12
|
-
if params[:
|
13
|
-
name = params[:
|
12
|
+
if params[:context_endpoint]
|
13
|
+
name = params[:context_endpoint].gsub( /[\/.:@]/,'_').gsub( '__','_')
|
14
14
|
name = "dry-#{name}".to_sym
|
15
|
-
endpoint = params[:
|
15
|
+
endpoint = params[:context_endpoint]
|
16
16
|
contexts = {}
|
17
17
|
exec_o_lines 'docker context ls --format json' do |line|
|
18
18
|
ctx = JSON.parse line, symbolize_names: true
|
data/lib/dry-stack/stack.rb
CHANGED
@@ -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
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.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-
|
11
|
+
date: 2024-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|