apmate 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/apmate/cli.rb +43 -1
- data/lib/apmate/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2496c46adbd57826ab1cb53f39b2a0bdd96e8a6
|
4
|
+
data.tar.gz: 07e364aee5bd76bc430cabdeca8561b9fb2774cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43660d40157633cb93dfcb2c2bfe4ec1ff7a1a8c5d2c8bf19ee019c306bcaadc140b9fe742bdf5fbde6d97b3eef921763ad2e86d9995b508a154eb3cad6f1a8c
|
7
|
+
data.tar.gz: fd8677d72b93413490996c1402a05e5fe815decb50a2fd35f6992d506d1be7b0e146b40c095f7b286cd8c96b968d22ab389392f41b4a43f2dd58081665f8d0d1
|
data/lib/apmate/cli.rb
CHANGED
@@ -102,6 +102,25 @@ class Apmate::CLI
|
|
102
102
|
log_output(output, opts)
|
103
103
|
end
|
104
104
|
|
105
|
+
def self.apmate_promote(env_from, env_to, opts)
|
106
|
+
Apmate::Logger.logger.debug "Beginning post request."
|
107
|
+
|
108
|
+
uri = URI("#{Apmate::CLI::APMATE_BASE_URL}:#{Apmate::CLI::APMATE_PORT}/api/environments/promote")
|
109
|
+
Apmate::Logger.logger.debug "uri: #{uri}"
|
110
|
+
|
111
|
+
payload = { environment_from: env_from, environment_to: env_to }
|
112
|
+
Apmate::Logger.logger.debug "payload: #{payload}"
|
113
|
+
|
114
|
+
request = Net::HTTP::Post.new(uri)
|
115
|
+
request.content_type = 'application/json'
|
116
|
+
request.body = payload.to_json
|
117
|
+
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
118
|
+
http.request(request)
|
119
|
+
end
|
120
|
+
output = JSON.pretty_generate(JSON.parse(response.body))
|
121
|
+
log_output(output, opts)
|
122
|
+
end
|
123
|
+
|
105
124
|
def self.log_output(output, opts)
|
106
125
|
Apmate::Logger.logger.info output
|
107
126
|
if opts[:output]
|
@@ -164,6 +183,28 @@ class Apmate::CLI
|
|
164
183
|
end
|
165
184
|
end
|
166
185
|
|
186
|
+
promote_command = Cri::Command.define do
|
187
|
+
name 'promote'
|
188
|
+
usage 'promote <environment_from_name> <environment_to_name>'
|
189
|
+
summary 'Promotes values from one environment to another environment.'
|
190
|
+
description 'Promotes values from one environment to another environment.'
|
191
|
+
|
192
|
+
flag :h, :help, 'show help for this command' do |value, cmd|
|
193
|
+
puts cmd.help
|
194
|
+
exit 0
|
195
|
+
end
|
196
|
+
|
197
|
+
run do |opts, args, cmd|
|
198
|
+
Apmate::Logger.log_level(opts)
|
199
|
+
Apmate::Logger.verbosity(opts)
|
200
|
+
Apmate::Logger.logger.debug "opts: #{opts}"
|
201
|
+
Apmate::Logger.logger.debug "args: #{args}"
|
202
|
+
Apmate::Logger.logger.debug "cmd: #{cmd.to_s}"
|
203
|
+
cmd.run(['-h']) unless args.count == 2
|
204
|
+
Apmate::CLI.apmate_promote(args[0], args[1], opts)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
167
208
|
apply_command = Cri::Command.define do
|
168
209
|
name 'apply'
|
169
210
|
usage 'apply [options] <arg>'
|
@@ -201,7 +242,8 @@ class Apmate::CLI
|
|
201
242
|
[
|
202
243
|
help_command,
|
203
244
|
apply_command,
|
204
|
-
get_command
|
245
|
+
get_command,
|
246
|
+
promote_command
|
205
247
|
].each do |cmd|
|
206
248
|
command.add_command cmd
|
207
249
|
end
|
data/lib/apmate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apmate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Baldridge
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|