aptible-cli 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/aptible-cli.gemspec +1 -0
- data/bin/aptible +9 -5
- data/lib/aptible/cli.rb +36 -0
- data/lib/aptible/cli/agent.rb +10 -6
- data/lib/aptible/cli/error.rb +6 -0
- data/lib/aptible/cli/formatter.rb +21 -0
- data/lib/aptible/cli/formatter/grouped_keyed_list.rb +54 -0
- data/lib/aptible/cli/formatter/keyed_list.rb +25 -0
- data/lib/aptible/cli/formatter/keyed_object.rb +16 -0
- data/lib/aptible/cli/formatter/list.rb +33 -0
- data/lib/aptible/cli/formatter/node.rb +8 -0
- data/lib/aptible/cli/formatter/object.rb +38 -0
- data/lib/aptible/cli/formatter/root.rb +46 -0
- data/lib/aptible/cli/formatter/value.rb +25 -0
- data/lib/aptible/cli/helpers/app.rb +1 -0
- data/lib/aptible/cli/helpers/database.rb +22 -6
- data/lib/aptible/cli/helpers/operation.rb +3 -2
- data/lib/aptible/cli/helpers/tunnel.rb +1 -3
- data/lib/aptible/cli/helpers/vhost.rb +9 -46
- data/lib/aptible/cli/renderer.rb +26 -0
- data/lib/aptible/cli/renderer/base.rb +8 -0
- data/lib/aptible/cli/renderer/json.rb +26 -0
- data/lib/aptible/cli/renderer/text.rb +99 -0
- data/lib/aptible/cli/resource_formatter.rb +136 -0
- data/lib/aptible/cli/subcommands/apps.rb +26 -14
- data/lib/aptible/cli/subcommands/backup.rb +22 -4
- data/lib/aptible/cli/subcommands/config.rb +15 -11
- data/lib/aptible/cli/subcommands/db.rb +82 -31
- data/lib/aptible/cli/subcommands/deploy.rb +1 -1
- data/lib/aptible/cli/subcommands/endpoints.rb +11 -8
- data/lib/aptible/cli/subcommands/operation.rb +2 -1
- data/lib/aptible/cli/subcommands/rebuild.rb +1 -1
- data/lib/aptible/cli/subcommands/restart.rb +1 -1
- data/lib/aptible/cli/subcommands/services.rb +8 -9
- data/lib/aptible/cli/version.rb +1 -1
- data/spec/aptible/cli/agent_spec.rb +11 -14
- data/spec/aptible/cli/formatter_spec.rb +4 -0
- data/spec/aptible/cli/renderer/json_spec.rb +63 -0
- data/spec/aptible/cli/renderer/text_spec.rb +150 -0
- data/spec/aptible/cli/resource_formatter_spec.rb +113 -0
- data/spec/aptible/cli/subcommands/apps_spec.rb +144 -28
- data/spec/aptible/cli/subcommands/backup_spec.rb +37 -16
- data/spec/aptible/cli/subcommands/config_spec.rb +95 -0
- data/spec/aptible/cli/subcommands/db_spec.rb +185 -93
- data/spec/aptible/cli/subcommands/endpoints_spec.rb +10 -8
- data/spec/aptible/cli/subcommands/operation_spec.rb +0 -1
- data/spec/aptible/cli/subcommands/rebuild_spec.rb +17 -0
- data/spec/aptible/cli/subcommands/services_spec.rb +8 -12
- data/spec/aptible/cli_spec.rb +31 -0
- data/spec/fabricators/account_fabricator.rb +11 -0
- data/spec/fabricators/app_fabricator.rb +15 -0
- data/spec/fabricators/configuration_fabricator.rb +8 -0
- data/spec/fabricators/database_image_fabricator.rb +17 -0
- data/spec/fabricators/operation_fabricator.rb +1 -0
- data/spec/fabricators/service_fabricator.rb +4 -0
- data/spec/spec_helper.rb +63 -1
- metadata +55 -4
- data/spec/aptible/cli/helpers/vhost_spec.rb +0 -105
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Aptible::CLI::Helpers::Vhost do
|
4
|
-
subject { Class.new.send(:include, described_class).new }
|
5
|
-
|
6
|
-
describe '#explain_vhost' do
|
7
|
-
let(:lines) { [] }
|
8
|
-
before { allow(subject).to receive(:say) { |m| lines << m } }
|
9
|
-
|
10
|
-
it 'explains a VHOST' do
|
11
|
-
service = Fabricate(:service, process_type: 'web')
|
12
|
-
vhost = Fabricate(
|
13
|
-
:vhost,
|
14
|
-
service: service,
|
15
|
-
external_host: 'foo.io',
|
16
|
-
status: 'provisioned',
|
17
|
-
type: 'http_proxy_protocol',
|
18
|
-
internal: false,
|
19
|
-
ip_whitelist: [],
|
20
|
-
default: false,
|
21
|
-
acme: false
|
22
|
-
)
|
23
|
-
subject.explain_vhost(service, vhost)
|
24
|
-
|
25
|
-
expected = [
|
26
|
-
'Service: web',
|
27
|
-
'Hostname: foo.io',
|
28
|
-
'Status: provisioned',
|
29
|
-
'Type: https',
|
30
|
-
'Port: default',
|
31
|
-
'Internal: false',
|
32
|
-
'IP Whitelist: all traffic',
|
33
|
-
'Default Domain Enabled: false',
|
34
|
-
'Managed TLS Enabled: false'
|
35
|
-
]
|
36
|
-
expect(lines).to eq(expected)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'explains a failed VHOST' do
|
40
|
-
vhost = Fabricate(:vhost, status: 'provision_failed')
|
41
|
-
subject.explain_vhost(vhost.service, vhost)
|
42
|
-
expect(lines).to include('Status: provision_failed')
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'explains an internal VHOST' do
|
46
|
-
vhost = Fabricate(:vhost, internal: true)
|
47
|
-
subject.explain_vhost(vhost.service, vhost)
|
48
|
-
expect(lines).to include('Internal: true')
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'explains a default VHOST' do
|
52
|
-
vhost = Fabricate(:vhost, default: true, virtual_domain: 'qux.io')
|
53
|
-
subject.explain_vhost(vhost.service, vhost)
|
54
|
-
expect(lines).to include('Default Domain Enabled: true')
|
55
|
-
expect(lines).to include('Default Domain: qux.io')
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'explains a TLS VHOST' do
|
59
|
-
vhost = Fabricate(:vhost, type: 'tls')
|
60
|
-
subject.explain_vhost(vhost.service, vhost)
|
61
|
-
expect(lines).to include('Type: tls')
|
62
|
-
expect(lines).to include('Ports: all')
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'explains a TCP VHOST' do
|
66
|
-
vhost = Fabricate(:vhost, type: 'tcp')
|
67
|
-
subject.explain_vhost(vhost.service, vhost)
|
68
|
-
expect(lines).to include('Type: tcp')
|
69
|
-
expect(lines).to include('Ports: all')
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'explains a VHOST with a container port' do
|
73
|
-
vhost = Fabricate(:vhost, type: 'http_proxy_protocol', container_port: 12)
|
74
|
-
subject.explain_vhost(vhost.service, vhost)
|
75
|
-
expect(lines).to include('Port: 12')
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'explains a VHOST with container ports' do
|
79
|
-
vhost = Fabricate(:vhost, type: 'tls', container_ports: [12, 34])
|
80
|
-
subject.explain_vhost(vhost.service, vhost)
|
81
|
-
expect(lines).to include('Ports: 12 34')
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'explains a VHOST with IP Filtering' do
|
85
|
-
vhost = Fabricate(:vhost, ip_whitelist: %w(1.1.1.1/1 2.2.2.2/2))
|
86
|
-
subject.explain_vhost(vhost.service, vhost)
|
87
|
-
expect(lines).to include('IP Whitelist: 1.1.1.1/1 2.2.2.2/2')
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'explains a VHOST with Managed TLS' do
|
91
|
-
vhost = Fabricate(
|
92
|
-
:vhost,
|
93
|
-
acme: true,
|
94
|
-
user_domain: 'foo.io',
|
95
|
-
acme_dns_challenge_host: 'dns.qux.io',
|
96
|
-
acme_status: 'ready'
|
97
|
-
)
|
98
|
-
subject.explain_vhost(vhost.service, vhost)
|
99
|
-
expect(lines).to include('Managed TLS Enabled: true')
|
100
|
-
expect(lines).to include('Managed TLS Domain: foo.io')
|
101
|
-
expect(lines).to include('Managed TLS DNS Challenge Hostname: dns.qux.io')
|
102
|
-
expect(lines).to include('Managed TLS Status: ready')
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|