aptible-cli 0.16.9 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/README.md +2 -0
- data/lib/aptible/cli/agent.rb +2 -0
- data/lib/aptible/cli/resource_formatter.rb +1 -0
- data/lib/aptible/cli/subcommands/environment.rb +49 -0
- data/lib/aptible/cli/version.rb +1 -1
- data/spec/aptible/cli/subcommands/environment_spec.rb +54 -0
- data/spec/fabricators/account_fabricator.rb +1 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e273e3c062fe9d8e365d630b268ea9397e6ea31598595c6ba9729c1d1a288c6d
|
4
|
+
data.tar.gz: 67607c3bcb1ce4c0c782403584f6037a6abe4f8af19544a531ea2ac286d8b1a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8283372d5967ed47fac292aea6dd979ea9be800551ad5312b44b043589317c90f733b043e90088c880c763293230e78c8464eceba32c5dd901cfa5f2b1684e83
|
7
|
+
data.tar.gz: 669627d3ec851644902b3b15e8531c8131977d0023b7304e87549cbc2ef986d7b1007c59477ec2ac147affacf2960409d04d70aef1da31ac9ab245db6467dedd
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -66,6 +66,8 @@ Commands:
|
|
66
66
|
aptible endpoints:tcp:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TCP Endpoint
|
67
67
|
aptible endpoints:tls:create [--app APP] SERVICE # Create an App TLS Endpoint
|
68
68
|
aptible endpoints:tls:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TLS Endpoint
|
69
|
+
aptible environment:ca_cert # Retrieve the CA certificate associated with the environment
|
70
|
+
aptible environment:list # List all environments
|
69
71
|
aptible help [COMMAND] # Describe available commands or one specific command
|
70
72
|
aptible login # Log in to Aptible
|
71
73
|
aptible logs [--app APP | --database DATABASE] # Follows logs from a running app or database
|
data/lib/aptible/cli/agent.rb
CHANGED
@@ -23,6 +23,7 @@ require_relative 'subcommands/apps'
|
|
23
23
|
require_relative 'subcommands/config'
|
24
24
|
require_relative 'subcommands/db'
|
25
25
|
require_relative 'subcommands/domains'
|
26
|
+
require_relative 'subcommands/environment'
|
26
27
|
require_relative 'subcommands/logs'
|
27
28
|
require_relative 'subcommands/ps'
|
28
29
|
require_relative 'subcommands/rebuild'
|
@@ -47,6 +48,7 @@ module Aptible
|
|
47
48
|
include Subcommands::Config
|
48
49
|
include Subcommands::DB
|
49
50
|
include Subcommands::Domains
|
51
|
+
include Subcommands::Environment
|
50
52
|
include Subcommands::Logs
|
51
53
|
include Subcommands::Ps
|
52
54
|
include Subcommands::Rebuild
|
@@ -23,6 +23,7 @@ module Aptible
|
|
23
23
|
node.value('created_at', backup.created_at)
|
24
24
|
node.value('region', backup.aws_region)
|
25
25
|
node.value('size', backup.size)
|
26
|
+
node.value('manual', backup.manual)
|
26
27
|
|
27
28
|
if backup.copied_from
|
28
29
|
node.keyed_object('copied_from', 'description') do |n|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Aptible
|
2
|
+
module CLI
|
3
|
+
module Subcommands
|
4
|
+
module Environment
|
5
|
+
def self.included(thor)
|
6
|
+
thor.class_eval do
|
7
|
+
include Helpers::Environment
|
8
|
+
include Helpers::Token
|
9
|
+
|
10
|
+
desc 'environment:list', 'List all environments'
|
11
|
+
option :environment
|
12
|
+
define_method 'environment:list' do
|
13
|
+
Formatter.render(Renderer.current) do |root|
|
14
|
+
root.keyed_list(
|
15
|
+
'handle'
|
16
|
+
) do |node|
|
17
|
+
scoped_environments(options).each do |account|
|
18
|
+
node.object do |n|
|
19
|
+
ResourceFormatter.inject_account(n, account)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'environment:ca_cert',
|
27
|
+
'Retrieve the CA certificate associated with the environment'
|
28
|
+
option :environment
|
29
|
+
define_method 'environment:ca_cert' do
|
30
|
+
Formatter.render(Renderer.current) do |root|
|
31
|
+
root.grouped_keyed_list(
|
32
|
+
'handle',
|
33
|
+
'ca_body'
|
34
|
+
) do |node|
|
35
|
+
scoped_environments(options).each do |account|
|
36
|
+
node.object do |n|
|
37
|
+
n.value('ca_body', account.ca_body)
|
38
|
+
ResourceFormatter.inject_account(n, account)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/aptible/cli/version.rb
CHANGED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Aptible::CLI::Agent do
|
4
|
+
let!(:a1) do
|
5
|
+
Fabricate(:account, handle: 'foo', ca_body: 'account 1 cert')
|
6
|
+
end
|
7
|
+
let!(:a2) do
|
8
|
+
Fabricate(:account, handle: 'bar', ca_body: '--account 2 cert--')
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:token) { double 'token' }
|
12
|
+
|
13
|
+
before do
|
14
|
+
allow(subject).to receive(:fetch_token) { token }
|
15
|
+
allow(Aptible::Api::Account).to receive(:all).with(token: token)
|
16
|
+
.and_return([a1, a2])
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'lists avaliable environments' do
|
20
|
+
subject.send('environment:list')
|
21
|
+
|
22
|
+
expect(captured_output_text.split("\n")).to include('foo')
|
23
|
+
expect(captured_output_text.split("\n")).to include('bar')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'fetches certs for all avaliable environments' do
|
27
|
+
subject.send('environment:ca_cert')
|
28
|
+
|
29
|
+
expect(captured_output_text.split("\n")).to include('account 1 cert')
|
30
|
+
expect(captured_output_text.split("\n")).to include('--account 2 cert--')
|
31
|
+
|
32
|
+
expected_accounts = [
|
33
|
+
{
|
34
|
+
'handle' => 'foo',
|
35
|
+
'ca_body' => 'account 1 cert'
|
36
|
+
},
|
37
|
+
{
|
38
|
+
'handle' => 'bar',
|
39
|
+
'ca_body' => '--account 2 cert--'
|
40
|
+
}
|
41
|
+
]
|
42
|
+
expect(captured_output_json.map! { |account| account.except('id') })
|
43
|
+
.to eq(expected_accounts)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'fetches certs for specified environment' do
|
47
|
+
subject.options = { environment: 'foo' }
|
48
|
+
subject.send('environment:ca_cert')
|
49
|
+
|
50
|
+
expect(captured_output_text.split("\n")).to include('account 1 cert')
|
51
|
+
expect(captured_output_text.split("\n"))
|
52
|
+
.to_not include('--account 2 cert--')
|
53
|
+
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aptible-resource
|
@@ -296,6 +296,7 @@ files:
|
|
296
296
|
- lib/aptible/cli/subcommands/deploy.rb
|
297
297
|
- lib/aptible/cli/subcommands/domains.rb
|
298
298
|
- lib/aptible/cli/subcommands/endpoints.rb
|
299
|
+
- lib/aptible/cli/subcommands/environment.rb
|
299
300
|
- lib/aptible/cli/subcommands/inspect.rb
|
300
301
|
- lib/aptible/cli/subcommands/logs.rb
|
301
302
|
- lib/aptible/cli/subcommands/operation.rb
|
@@ -325,6 +326,7 @@ files:
|
|
325
326
|
- spec/aptible/cli/subcommands/deploy_spec.rb
|
326
327
|
- spec/aptible/cli/subcommands/domains_spec.rb
|
327
328
|
- spec/aptible/cli/subcommands/endpoints_spec.rb
|
329
|
+
- spec/aptible/cli/subcommands/environment_spec.rb
|
328
330
|
- spec/aptible/cli/subcommands/inspect_spec.rb
|
329
331
|
- spec/aptible/cli/subcommands/logs_spec.rb
|
330
332
|
- spec/aptible/cli/subcommands/operation_spec.rb
|
@@ -374,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
374
376
|
- !ruby/object:Gem::Version
|
375
377
|
version: '0'
|
376
378
|
requirements: []
|
377
|
-
rubygems_version: 3.0.
|
379
|
+
rubygems_version: 3.0.9
|
378
380
|
signing_key:
|
379
381
|
specification_version: 4
|
380
382
|
summary: Command-line interface for Aptible services
|
@@ -398,6 +400,7 @@ test_files:
|
|
398
400
|
- spec/aptible/cli/subcommands/deploy_spec.rb
|
399
401
|
- spec/aptible/cli/subcommands/domains_spec.rb
|
400
402
|
- spec/aptible/cli/subcommands/endpoints_spec.rb
|
403
|
+
- spec/aptible/cli/subcommands/environment_spec.rb
|
401
404
|
- spec/aptible/cli/subcommands/inspect_spec.rb
|
402
405
|
- spec/aptible/cli/subcommands/logs_spec.rb
|
403
406
|
- spec/aptible/cli/subcommands/operation_spec.rb
|