Skip to content

Commit ddb1ef7

Browse files
committed
update
1 parent c69ad0d commit ddb1ef7

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
dry-stack (0.1.41)
4+
dry-stack (0.1.42)
55

66
GEM
77
remote: https://rubygems.org/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This gem allows ...
66
cat simple_stack.drs | dry-stack -e to_compose | docker stack deploy -c - simple_stack
77
88
$ dry-stack
9-
Version: 0.1.41
9+
Version: 0.1.42
1010
Usage:
1111
dry-stack -s stackfile [options] COMMAND
1212
cat stackfile | dry-stack COMMAND

lib/dry-stack/command_swarm_deploy.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
require_relative 'command_line'
2+
require 'net/http'
3+
require 'uri'
24

35
Dry::CommandLine::COMMANDS[:swarm_deploy] = Class.new do
46
def options(parser)
@@ -67,9 +69,17 @@ def run(stack, params, args, extra)
6769
deploy_status:,
6870
stack: YAML.load(yaml, aliases: true)
6971
}
70-
exec_i "curl -s -X POST #{deploy_registry}/api/v1/swarm_deploy -H 'Content-Type: application/json' -d @-", data.to_json do |return_value, std_out, std_err|
71-
puts "POST Return value: #{return_value}"
72-
end
72+
73+
uri = URI("#{deploy_registry}/api/v1/swarm_deploy")
74+
http = Net::HTTP.new(uri.host, uri.port)
75+
http.use_ssl = uri.scheme == 'https'
76+
77+
request = Net::HTTP::Post.new(uri)
78+
request['Content-Type'] = 'application/json'
79+
request.body = data.to_json
80+
81+
response = http.request(request)
82+
puts "POST Return value: #{response.code}"
7383
end
7484
end
7585
end

lib/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Dry
22
class Stack
3-
VERSION = '0.1.41'
3+
VERSION = '0.1.42'
44
end
55
end

0 commit comments

Comments
 (0)