apmate 0.4.0 → 0.5.0
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 +4 -4
- data/lib/apmate.rb +1 -0
- data/lib/apmate/cli.rb +15 -8
- data/lib/apmate/commands/mass_promote.rb +26 -0
- data/lib/apmate/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3e9cdc8c3e4972b8c0c4ff689505de4c5933920
|
4
|
+
data.tar.gz: 4be057e69126b3b64ba313f35fa9dd55d29fc1f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f9808113b7fe238d07bb1cafdc4c1286ed53993101eb54ebaebfa258e4c93b13e59b898ca38b2a2070b472e40b6355850b058b06a7ac51bf011e2bd30806296
|
7
|
+
data.tar.gz: d011852172d3c587469bbab1e257b5d3ca99ed25392dc8f6a1675a5abcaa642f25c418afcfaabd04df747a300237a34acce33f7168c3fb0aafbcfe3f5d96f2bf
|
data/lib/apmate.rb
CHANGED
@@ -9,5 +9,6 @@ require 'apmate/commands/get/artifact'
|
|
9
9
|
require 'apmate/commands/get/artifact_environment'
|
10
10
|
require 'apmate/commands/get/artifact_name'
|
11
11
|
require 'apmate/commands/apply'
|
12
|
+
require 'apmate/commands/mass_promote'
|
12
13
|
require 'apmate/commands/promote'
|
13
14
|
require 'apmate/commands/execution'
|
data/lib/apmate/cli.rb
CHANGED
@@ -17,6 +17,7 @@ class Apmate::CLI
|
|
17
17
|
get_artifact_environment: '/api/artifacts/environment',
|
18
18
|
get_artifact: '/api/artifacts',
|
19
19
|
get_artifact_name: '/api/artifacts/name',
|
20
|
+
mass_promote_environment: '/api/applications/mass_promote',
|
20
21
|
promote_environment: '/api/environments/promote',
|
21
22
|
create_execution: '/api/executions'
|
22
23
|
}
|
@@ -106,6 +107,18 @@ class Apmate::CLI
|
|
106
107
|
log_output(output, opts)
|
107
108
|
end
|
108
109
|
|
110
|
+
def self.apmate_mass_promote(env_from, env_to, opts)
|
111
|
+
Apmate::Logger.logger.debug "Beginning post request for mass promote."
|
112
|
+
|
113
|
+
uri = URI("#{Apmate::CLI::APMATE_URL}#{ENDPOINTS[:mass_promote_environment]}")
|
114
|
+
Apmate::Logger.logger.debug "uri: #{uri}"
|
115
|
+
|
116
|
+
payload = { env_from: env_from, env_to: env_to }
|
117
|
+
Apmate::Logger.logger.debug "payload: #{payload}"
|
118
|
+
|
119
|
+
apmate_post uri, payload, opts
|
120
|
+
end
|
121
|
+
|
109
122
|
def self.apmate_promote(env_from, env_to, artifact, opts)
|
110
123
|
Apmate::Logger.logger.debug "Beginning post request."
|
111
124
|
|
@@ -115,14 +128,7 @@ class Apmate::CLI
|
|
115
128
|
payload = { environment_from: env_from, environment_to: env_to, artifact: artifact }
|
116
129
|
Apmate::Logger.logger.debug "payload: #{payload}"
|
117
130
|
|
118
|
-
|
119
|
-
request.content_type = 'application/json'
|
120
|
-
request.body = payload.to_json
|
121
|
-
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
122
|
-
http.request(request)
|
123
|
-
end
|
124
|
-
output = JSON.pretty_generate(JSON.parse(response.body))
|
125
|
-
log_output(output, opts)
|
131
|
+
apmate_post uri, payload, opts
|
126
132
|
end
|
127
133
|
|
128
134
|
def self.log_output(output, opts)
|
@@ -152,6 +158,7 @@ class Apmate::CLI
|
|
152
158
|
Command::HELP,
|
153
159
|
Command::APPLY,
|
154
160
|
get_command,
|
161
|
+
Command::MASS_PROMOTE,
|
155
162
|
Command::PROMOTE,
|
156
163
|
Command::CREATE_EXECUTION
|
157
164
|
].each do |cmd|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Apmate::CLI::Command
|
2
|
+
MASS_PROMOTE = Cri::Command.define do
|
3
|
+
name 'mass_promote'
|
4
|
+
usage 'mass_promote <environment_from> <environment_to> [artifact]'
|
5
|
+
summary "Promotes all artifacts' environment values from one general environment to another environment."
|
6
|
+
description %q(
|
7
|
+
Promotes all artifacts' environment values from one general environment to another environment.
|
8
|
+
WARNING: Use with caution. There is no "undo" for this. Take a backup first.
|
9
|
+
)
|
10
|
+
|
11
|
+
flag :h, :help, 'show help for this command' do |value, cmd|
|
12
|
+
puts cmd.help
|
13
|
+
exit 0
|
14
|
+
end
|
15
|
+
|
16
|
+
run do |opts, args, cmd|
|
17
|
+
Apmate::Logger.log_level(opts)
|
18
|
+
Apmate::Logger.verbosity(opts)
|
19
|
+
Apmate::Logger.logger.debug "opts: #{opts}"
|
20
|
+
Apmate::Logger.logger.debug "args: #{args}"
|
21
|
+
Apmate::Logger.logger.debug "cmd: #{cmd.to_s}"
|
22
|
+
cmd.run(['-h']) unless (args.count == 2)
|
23
|
+
Apmate::CLI.apmate_mass_promote(args[0], args[1], opts)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Baldridge
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/apmate/commands/get/artifact_environment.rb
|
86
86
|
- lib/apmate/commands/get/artifact_name.rb
|
87
87
|
- lib/apmate/commands/help.rb
|
88
|
+
- lib/apmate/commands/mass_promote.rb
|
88
89
|
- lib/apmate/commands/promote.rb
|
89
90
|
- lib/apmate/logger/logger.rb
|
90
91
|
- lib/apmate/version.rb
|