apmate 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48fb29f3369c91d7f198329c9d56970d16ed86c4
4
- data.tar.gz: d1f48cbff536affe35281e9a2569527d66731e19
3
+ metadata.gz: d3e9cdc8c3e4972b8c0c4ff689505de4c5933920
4
+ data.tar.gz: 4be057e69126b3b64ba313f35fa9dd55d29fc1f9
5
5
  SHA512:
6
- metadata.gz: b5fbd1465e4179e41a98fad45160543978cc7c7d69120a5ab66c67fa633007ecfe6c61af2f0acfd84ee6837431470897dc5edf287b4375fc770b6fc7d4b2144b
7
- data.tar.gz: ad610c19fda43eb310822d021cd39a03a8a930f94fd20901666eafbd254befef79bf2d4dd31a515648fb793f1d327ccb7578c253c8c598116937515240d7959d
6
+ metadata.gz: 2f9808113b7fe238d07bb1cafdc4c1286ed53993101eb54ebaebfa258e4c93b13e59b898ca38b2a2070b472e40b6355850b058b06a7ac51bf011e2bd30806296
7
+ data.tar.gz: d011852172d3c587469bbab1e257b5d3ca99ed25392dc8f6a1675a5abcaa642f25c418afcfaabd04df747a300237a34acce33f7168c3fb0aafbcfe3f5d96f2bf
@@ -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'
@@ -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
- request = Net::HTTP::Post.new(uri)
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
@@ -1,3 +1,3 @@
1
1
  module Apmate
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
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.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: 2018-12-13 00:00:00.000000000 Z
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