apmate 0.5.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3e9cdc8c3e4972b8c0c4ff689505de4c5933920
4
- data.tar.gz: 4be057e69126b3b64ba313f35fa9dd55d29fc1f9
3
+ metadata.gz: c0e7a91181a6fcab0265881556380b59683488a7
4
+ data.tar.gz: f817037b063d8fb21eabf9c4650bfcc909fe4328
5
5
  SHA512:
6
- metadata.gz: 2f9808113b7fe238d07bb1cafdc4c1286ed53993101eb54ebaebfa258e4c93b13e59b898ca38b2a2070b472e40b6355850b058b06a7ac51bf011e2bd30806296
7
- data.tar.gz: d011852172d3c587469bbab1e257b5d3ca99ed25392dc8f6a1675a5abcaa642f25c418afcfaabd04df747a300237a34acce33f7168c3fb0aafbcfe3f5d96f2bf
6
+ metadata.gz: f4ed00503f78285b9ae60e10000ad75ca538306cbf409b3b9d58517ebacace8b55b9200d5a4221e587922926a80b9553df03a871f99aea25965042b52fc74d27
7
+ data.tar.gz: 57a80304e6e3d4313d1dfbc4d0581a7d91f639081b17b026627b8ec10b8702779ab471b1befaee921cb8a934cbb3aa398b1d81cb35eb781fe04622fdcb04f7b4
data/lib/apmate.rb CHANGED
@@ -12,3 +12,4 @@ require 'apmate/commands/apply'
12
12
  require 'apmate/commands/mass_promote'
13
13
  require 'apmate/commands/promote'
14
14
  require 'apmate/commands/execution'
15
+ require 'apmate/commands/publish_artifact'
data/lib/apmate/cli.rb CHANGED
@@ -19,7 +19,8 @@ class Apmate::CLI
19
19
  get_artifact_name: '/api/artifacts/name',
20
20
  mass_promote_environment: '/api/applications/mass_promote',
21
21
  promote_environment: '/api/environments/promote',
22
- create_execution: '/api/executions'
22
+ create_execution: '/api/executions',
23
+ publish_artifact: '/api/artifacts/publish'
23
24
  }
24
25
 
25
26
  def self.apply_file(file, opts)
@@ -131,6 +132,21 @@ class Apmate::CLI
131
132
  apmate_post uri, payload, opts
132
133
  end
133
134
 
135
+ def self.publish_artifact(name, environment_name, opts)
136
+ Apmate::Logger.logger.debug "Beginning to publish artifact."
137
+
138
+ uri = URI("#{Apmate::CLI::APMATE_URL}#{ENDPOINTS[:publish_artifact]}")
139
+ Apmate::Logger.logger.debug "uri: #{uri}"
140
+
141
+ payload = { artifact: { name: name, environment_name: environment_name } }
142
+ opts.each do |opt, value|
143
+ payload[:artifact][opt] = value
144
+ end
145
+ Apmate::Logger.logger.debug "payload: #{payload}"
146
+
147
+ apmate_post uri, payload, opts
148
+ end
149
+
134
150
  def self.log_output(output, opts)
135
151
  Apmate::Logger.logger.info output
136
152
  if opts[:output]
@@ -160,7 +176,8 @@ class Apmate::CLI
160
176
  get_command,
161
177
  Command::MASS_PROMOTE,
162
178
  Command::PROMOTE,
163
- Command::CREATE_EXECUTION
179
+ Command::CREATE_EXECUTION,
180
+ Command::PUBLISH_ARTIFACT
164
181
  ].each do |cmd|
165
182
  command.add_command cmd
166
183
  end
@@ -0,0 +1,32 @@
1
+ module Apmate::CLI::Command
2
+ PUBLISH_ARTIFACT = Cri::Command.define do
3
+ name 'publish_artifact'
4
+ usage 'publish_artifact [options] <name> <environment_name>'
5
+ summary "Publishes artifact information to Apmate for each environment with environment_name."
6
+ description %q(
7
+ Publishes artifact information to Apmate for each environment with environment_name.
8
+ Must have at least one option specified.
9
+ WARNING: Use with caution. There is no "undo" for this. Take a backup first.
10
+ )
11
+
12
+ flag :h, :help, 'show help for this command' do |value, cmd|
13
+ puts cmd.help
14
+ exit 0
15
+ end
16
+
17
+ option nil, :version, 'set artifact version', argument: :required
18
+ option nil, :repository, 'set artifact repository', argument: :required
19
+ option nil, :promote, 'mark artifact for promotion', argument: :required
20
+
21
+ run do |opts, args, cmd|
22
+ Apmate::Logger.log_level(opts)
23
+ Apmate::Logger.verbosity(opts)
24
+ Apmate::Logger.logger.debug "opts: #{opts}"
25
+ Apmate::Logger.logger.debug "args: #{args}"
26
+ Apmate::Logger.logger.debug "cmd: #{cmd.to_s}"
27
+ cmd.run(['-h']) unless (args.count == 2)
28
+ cmd.run(['-h']) unless (opts.count > 0)
29
+ Apmate::CLI.publish_artifact(args[0], args[1], opts)
30
+ end
31
+ end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module Apmate
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.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.5.0
4
+ version: 0.6.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: 2019-05-15 00:00:00.000000000 Z
11
+ date: 2019-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri
@@ -87,6 +87,7 @@ files:
87
87
  - lib/apmate/commands/help.rb
88
88
  - lib/apmate/commands/mass_promote.rb
89
89
  - lib/apmate/commands/promote.rb
90
+ - lib/apmate/commands/publish_artifact.rb
90
91
  - lib/apmate/logger/logger.rb
91
92
  - lib/apmate/version.rb
92
93
  homepage:
@@ -109,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
110
  version: '0'
110
111
  requirements: []
111
112
  rubyforge_project:
112
- rubygems_version: 2.6.11
113
+ rubygems_version: 2.6.8
113
114
  signing_key:
114
115
  specification_version: 4
115
116
  summary: A CLI interface for Apmate Environment Datastore.