dry-stack 0.1.32 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc2ab0e6d10d0b126d5d287cdf6e1f00af9f9b53921f66cba06e63451e87aa73
4
- data.tar.gz: 83ae8ddff816ae5db40c3bd5f9f51aca29ab12c47da183cfb15e360ee2c17fdf
3
+ metadata.gz: c7e2506b9b5b680a2ea87d238fd437b6c97fd66640686539d41f64b325637795
4
+ data.tar.gz: 8ccfa44bcab2e05529384a893570a4abb976155adbf014ddfbe8b9388fb6b029
5
5
  SHA512:
6
- metadata.gz: d673622f2a97fcc43733e83609eedc7afc827de92780710c01ecd24cccf7f0a698f8bbe8a08bc40d187f0ae01f6d5d37e35f652247f650261e0878c56e99667e
7
- data.tar.gz: 32e9c0325d75775668bdfddeff0f8c670dc64445a9ce5a3808ebd53baf0e0322bfc82769ddcbb3fdf8c35c12d129b47af4a9816693e86727f2f193b8fc950566
6
+ metadata.gz: 6b396dabe77eda339d752957c005a05d4e45449fe9b02d5bd86488a1f16f07d1c78a15b7e0a6eb4880def34eba9fab55dacae86b86f631d148f27b7e304d49c2
7
+ data.tar.gz: 17256198254f8fc0c9b649ccd8c7d2994878d72d0b0c5f594283f9023457cd3fade80f15d9b53d8bfbaa7a5d3eb55fc5d7b5f3cb653c80e54eb32e823381b84c
@@ -1,16 +1,22 @@
1
1
  require_relative '../version'
2
2
  require 'open3'
3
3
 
4
- def exec_i(cmd, input_string = nil)
4
+ def exec_i(cmd, input_string = nil, &block)
5
5
  puts "exec_i(inputs.size #{input_string&.size}): #{cmd}"
6
6
  Open3.popen3(cmd) do |i, o, e, wait_thr|
7
+ std_out, std_err = '', ''
7
8
  i.puts input_string unless input_string.nil?
8
9
  i.close
9
- while line = o.gets; puts "o: " + line end
10
- while line = e.gets; puts "o: " + line end
10
+ while line = o.gets; puts "o: #{line}"; std_out += "#{line}\n" end
11
+ while line = e.gets; puts "o: #{line}"; std_err += "#{line}\n" end
11
12
  return_value = wait_thr.value
12
13
  puts "Error level was: #{return_value.exitstatus}" unless return_value.success?
13
- exit return_value.exitstatus unless return_value.success?
14
+
15
+ if block_given?
16
+ block.call return_value, std_out, std_err
17
+ else
18
+ exit return_value.exitstatus unless return_value.success?
19
+ end
14
20
  end
15
21
  end
16
22
 
@@ -26,8 +26,11 @@ Dry::CommandLine::COMMANDS[:swarm_deploy] = Class.new do
26
26
  raise "context '#{name}' has different host value: #{contexts[name][:DockerEndpoint]} != #{endpoint}"
27
27
  end
28
28
 
29
- exec_i "docker context create #{name} --docker host=#{endpoint}" unless contexts[name]
30
- # TODO: o: context "dry-ssh__gis-master_ru" already exists
29
+ unless contexts[name]
30
+ exec_i "docker context create #{name} --docker host=#{endpoint}" do |return_value, _o, e|
31
+ exit return_value.exitstatus unless return_value.success? || e !~ /already exists/m
32
+ end
33
+ end
31
34
 
32
35
  ENV['DOCKER_CONTEXT'] = name.to_s
33
36
 
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  class Stack
3
- VERSION = '0.1.32'
3
+ VERSION = '0.1.33'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.32
4
+ version: 0.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B