aptible-cli 0.13.0 → 0.14.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 +12 -2
- data/aptible-cli.gemspec +4 -3
- data/lib/aptible/cli/agent.rb +9 -2
- data/lib/aptible/cli/helpers/app.rb +19 -0
- data/lib/aptible/cli/helpers/app_or_database.rb +34 -0
- data/lib/aptible/cli/helpers/vhost.rb +83 -0
- data/lib/aptible/cli/helpers/vhost/option_set_builder.rb +292 -0
- data/lib/aptible/cli/subcommands/apps.rb +1 -13
- data/lib/aptible/cli/subcommands/domains.rb +3 -1
- data/lib/aptible/cli/subcommands/endpoints.rb +183 -0
- data/lib/aptible/cli/subcommands/logs.rb +5 -16
- data/lib/aptible/cli/version.rb +1 -1
- data/spec/aptible/cli/helpers/vhost_spec.rb +105 -0
- data/spec/aptible/cli/subcommands/apps_spec.rb +1 -1
- data/spec/aptible/cli/subcommands/endpoints_spec.rb +604 -0
- data/spec/fabricators/account_fabricator.rb +7 -1
- data/spec/fabricators/app_fabricator.rb +5 -0
- data/spec/fabricators/certificate_fabricator.rb +11 -0
- data/spec/fabricators/database_fabricator.rb +10 -1
- data/spec/fabricators/service_fabricator.rb +25 -3
- data/spec/fabricators/vhost_fabricator.rb +5 -2
- metadata +38 -8
@@ -1,4 +1,9 @@
|
|
1
|
-
class StubAccount < OpenStruct
|
1
|
+
class StubAccount < OpenStruct
|
2
|
+
def each_certificate(&block)
|
3
|
+
return enum_for(:each_certificate) if block.nil?
|
4
|
+
certificates.each(&block)
|
5
|
+
end
|
6
|
+
end
|
2
7
|
|
3
8
|
Fabricator(:account, from: :stub_account) do
|
4
9
|
bastion_host 'localhost'
|
@@ -8,4 +13,5 @@ Fabricator(:account, from: :stub_account) do
|
|
8
13
|
|
9
14
|
apps { [] }
|
10
15
|
databases { [] }
|
16
|
+
certificates { [] }
|
11
17
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class StubCertificate < OpenStruct; end
|
2
|
+
|
3
|
+
Fabricator(:certificate, from: :stub_certificate) do
|
4
|
+
account
|
5
|
+
|
6
|
+
sha256_fingerprint do
|
7
|
+
Fabricate.sequence(:sha256) { |i| Digest::SHA256.hexdigest(i.to_s) }
|
8
|
+
end
|
9
|
+
|
10
|
+
after_create { |cert| cert.account.certificates << cert }
|
11
|
+
end
|
@@ -5,17 +5,26 @@ class StubDatabase < OpenStruct
|
|
5
5
|
end
|
6
6
|
|
7
7
|
Fabricator(:database, from: :stub_database) do
|
8
|
+
transient :service
|
9
|
+
|
8
10
|
type 'postgresql'
|
9
11
|
handle do |attrs|
|
10
12
|
Fabricate.sequence(:database) { |i| "#{attrs[:type]}-#{i}" }
|
11
13
|
end
|
14
|
+
|
12
15
|
passphrase 'password'
|
13
16
|
status 'provisioned'
|
14
17
|
connection_url 'postgresql://aptible:password@10.252.1.125:49158/db'
|
15
18
|
account
|
19
|
+
service { nil }
|
16
20
|
|
17
21
|
backups { [] }
|
18
22
|
database_credentials { [] }
|
19
23
|
|
20
|
-
after_create
|
24
|
+
after_create do |database, transients|
|
25
|
+
database.account.databases << database
|
26
|
+
database.service = transients[:service] || Fabricate(
|
27
|
+
:service, app: nil, database: database
|
28
|
+
)
|
29
|
+
end
|
21
30
|
end
|
@@ -1,9 +1,31 @@
|
|
1
|
-
class StubService < OpenStruct
|
1
|
+
class StubService < OpenStruct
|
2
|
+
def each_vhost(&block)
|
3
|
+
return enum_for(:each_vhost) if block.nil?
|
4
|
+
vhosts.each(&block)
|
5
|
+
end
|
6
|
+
end
|
2
7
|
|
3
8
|
Fabricator(:service, from: :stub_service) do
|
9
|
+
transient :app, :database
|
10
|
+
|
4
11
|
process_type 'web'
|
5
|
-
app
|
6
12
|
vhosts { [] }
|
7
13
|
|
8
|
-
after_create
|
14
|
+
after_create do |service, transients|
|
15
|
+
if transients[:app]
|
16
|
+
service.app = transients[:app]
|
17
|
+
elsif transients[:database]
|
18
|
+
service.database = transients[:database]
|
19
|
+
else
|
20
|
+
service.app = Fabricate(:app)
|
21
|
+
end
|
22
|
+
|
23
|
+
if service.app
|
24
|
+
service.app.services << service
|
25
|
+
service.account = service.app.account
|
26
|
+
else
|
27
|
+
service.database.service = service
|
28
|
+
service.account = service.database.account
|
29
|
+
end
|
30
|
+
end
|
9
31
|
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
class StubVhost < OpenStruct; end
|
2
2
|
|
3
3
|
Fabricator(:vhost, from: :stub_vhost) do
|
4
|
-
virtual_domain 'domain1'
|
5
|
-
external_host 'host1'
|
6
4
|
service
|
7
5
|
|
6
|
+
external_host { Fabricate.sequence(:external_host) { |i| "host#{i}" } }
|
7
|
+
virtual_domain { Fabricate.sequence(:virtual_domain) { |i| "domain#{i}" } }
|
8
|
+
ip_whitelist { [] }
|
9
|
+
container_ports { [] }
|
10
|
+
|
8
11
|
after_create { |vhost| vhost.service.vhosts << vhost }
|
9
12
|
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.14.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: 2017-
|
11
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aptible-resource
|
@@ -16,42 +16,62 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.1
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
29
|
+
version: '1.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.1
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: aptible-api
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
39
|
+
version: '1.0'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
46
|
+
version: '1.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: aptible-auth
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0
|
53
|
+
version: '1.0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: aptible-billing
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.0'
|
48
68
|
type: :runtime
|
49
69
|
prerelease: false
|
50
70
|
version_requirements: !ruby/object:Gem::Requirement
|
51
71
|
requirements:
|
52
72
|
- - "~>"
|
53
73
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0
|
74
|
+
version: '1.0'
|
55
75
|
- !ruby/object:Gem::Dependency
|
56
76
|
name: thor
|
57
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,18 +248,22 @@ files:
|
|
228
248
|
- lib/aptible/cli.rb
|
229
249
|
- lib/aptible/cli/agent.rb
|
230
250
|
- lib/aptible/cli/helpers/app.rb
|
251
|
+
- lib/aptible/cli/helpers/app_or_database.rb
|
231
252
|
- lib/aptible/cli/helpers/database.rb
|
232
253
|
- lib/aptible/cli/helpers/environment.rb
|
233
254
|
- lib/aptible/cli/helpers/operation.rb
|
234
255
|
- lib/aptible/cli/helpers/ssh.rb
|
235
256
|
- lib/aptible/cli/helpers/token.rb
|
236
257
|
- lib/aptible/cli/helpers/tunnel.rb
|
258
|
+
- lib/aptible/cli/helpers/vhost.rb
|
259
|
+
- lib/aptible/cli/helpers/vhost/option_set_builder.rb
|
237
260
|
- lib/aptible/cli/subcommands/apps.rb
|
238
261
|
- lib/aptible/cli/subcommands/backup.rb
|
239
262
|
- lib/aptible/cli/subcommands/config.rb
|
240
263
|
- lib/aptible/cli/subcommands/db.rb
|
241
264
|
- lib/aptible/cli/subcommands/deploy.rb
|
242
265
|
- lib/aptible/cli/subcommands/domains.rb
|
266
|
+
- lib/aptible/cli/subcommands/endpoints.rb
|
243
267
|
- lib/aptible/cli/subcommands/inspect.rb
|
244
268
|
- lib/aptible/cli/subcommands/logs.rb
|
245
269
|
- lib/aptible/cli/subcommands/operation.rb
|
@@ -257,11 +281,13 @@ files:
|
|
257
281
|
- spec/aptible/cli/helpers/ssh_spec.rb
|
258
282
|
- spec/aptible/cli/helpers/token_spec.rb
|
259
283
|
- spec/aptible/cli/helpers/tunnel_spec.rb
|
284
|
+
- spec/aptible/cli/helpers/vhost_spec.rb
|
260
285
|
- spec/aptible/cli/subcommands/apps_spec.rb
|
261
286
|
- spec/aptible/cli/subcommands/backup_spec.rb
|
262
287
|
- spec/aptible/cli/subcommands/db_spec.rb
|
263
288
|
- spec/aptible/cli/subcommands/deploy_spec.rb
|
264
289
|
- spec/aptible/cli/subcommands/domains_spec.rb
|
290
|
+
- spec/aptible/cli/subcommands/endpoints_spec.rb
|
265
291
|
- spec/aptible/cli/subcommands/inspect_spec.rb
|
266
292
|
- spec/aptible/cli/subcommands/logs_spec.rb
|
267
293
|
- spec/aptible/cli/subcommands/operation_spec.rb
|
@@ -270,6 +296,7 @@ files:
|
|
270
296
|
- spec/fabricators/account_fabricator.rb
|
271
297
|
- spec/fabricators/app_fabricator.rb
|
272
298
|
- spec/fabricators/backup_fabricator.rb
|
299
|
+
- spec/fabricators/certificate_fabricator.rb
|
273
300
|
- spec/fabricators/database_credential_fabricator.rb
|
274
301
|
- spec/fabricators/database_fabricator.rb
|
275
302
|
- spec/fabricators/operation_fabricator.rb
|
@@ -319,11 +346,13 @@ test_files:
|
|
319
346
|
- spec/aptible/cli/helpers/ssh_spec.rb
|
320
347
|
- spec/aptible/cli/helpers/token_spec.rb
|
321
348
|
- spec/aptible/cli/helpers/tunnel_spec.rb
|
349
|
+
- spec/aptible/cli/helpers/vhost_spec.rb
|
322
350
|
- spec/aptible/cli/subcommands/apps_spec.rb
|
323
351
|
- spec/aptible/cli/subcommands/backup_spec.rb
|
324
352
|
- spec/aptible/cli/subcommands/db_spec.rb
|
325
353
|
- spec/aptible/cli/subcommands/deploy_spec.rb
|
326
354
|
- spec/aptible/cli/subcommands/domains_spec.rb
|
355
|
+
- spec/aptible/cli/subcommands/endpoints_spec.rb
|
327
356
|
- spec/aptible/cli/subcommands/inspect_spec.rb
|
328
357
|
- spec/aptible/cli/subcommands/logs_spec.rb
|
329
358
|
- spec/aptible/cli/subcommands/operation_spec.rb
|
@@ -332,6 +361,7 @@ test_files:
|
|
332
361
|
- spec/fabricators/account_fabricator.rb
|
333
362
|
- spec/fabricators/app_fabricator.rb
|
334
363
|
- spec/fabricators/backup_fabricator.rb
|
364
|
+
- spec/fabricators/certificate_fabricator.rb
|
335
365
|
- spec/fabricators/database_credential_fabricator.rb
|
336
366
|
- spec/fabricators/database_fabricator.rb
|
337
367
|
- spec/fabricators/operation_fabricator.rb
|