af 0.3.22 → 0.5.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- data/LICENSE +1277 -24
- data/Rakefile +24 -87
- data/bin/af +7 -2
- data/lib/af/version.rb +3 -0
- data/lib/vmc.rb +7 -2
- data/lib/vmc/cli.rb +475 -0
- data/lib/vmc/cli/app/app.rb +45 -0
- data/lib/vmc/cli/app/apps.rb +105 -0
- data/lib/vmc/cli/app/base.rb +82 -0
- data/lib/vmc/cli/app/crashes.rb +46 -0
- data/lib/vmc/cli/app/delete.rb +95 -0
- data/lib/vmc/cli/app/deprecated.rb +11 -0
- data/lib/vmc/cli/app/env.rb +78 -0
- data/lib/vmc/cli/app/files.rb +137 -0
- data/lib/vmc/cli/app/health.rb +26 -0
- data/lib/vmc/cli/app/instances.rb +53 -0
- data/lib/vmc/cli/app/logs.rb +76 -0
- data/lib/vmc/cli/app/push.rb +107 -0
- data/lib/vmc/cli/app/push/create.rb +150 -0
- data/lib/vmc/cli/app/push/interactions.rb +100 -0
- data/lib/vmc/cli/app/push/sync.rb +64 -0
- data/lib/vmc/cli/app/rename.rb +39 -0
- data/lib/vmc/cli/app/restart.rb +20 -0
- data/lib/vmc/cli/app/scale.rb +71 -0
- data/lib/vmc/cli/app/start.rb +93 -0
- data/lib/vmc/cli/app/stats.rb +67 -0
- data/lib/vmc/cli/app/stop.rb +27 -0
- data/lib/vmc/cli/domain/base.rb +12 -0
- data/lib/vmc/cli/domain/domains.rb +40 -0
- data/lib/vmc/cli/domain/map.rb +55 -0
- data/lib/vmc/cli/domain/unmap.rb +56 -0
- data/lib/vmc/cli/help.rb +16 -0
- data/lib/vmc/cli/interactive.rb +105 -0
- data/lib/vmc/cli/organization/base.rb +14 -0
- data/lib/vmc/cli/organization/create.rb +32 -0
- data/lib/vmc/cli/organization/delete.rb +73 -0
- data/lib/vmc/cli/organization/org.rb +45 -0
- data/lib/vmc/cli/organization/orgs.rb +35 -0
- data/lib/vmc/cli/organization/rename.rb +36 -0
- data/lib/vmc/cli/route/base.rb +12 -0
- data/lib/vmc/cli/route/map.rb +80 -0
- data/lib/vmc/cli/route/routes.rb +26 -0
- data/lib/vmc/cli/route/unmap.rb +94 -0
- data/lib/vmc/cli/service/base.rb +8 -0
- data/lib/vmc/cli/service/bind.rb +44 -0
- data/lib/vmc/cli/service/create.rb +126 -0
- data/lib/vmc/cli/service/delete.rb +86 -0
- data/lib/vmc/cli/service/rename.rb +35 -0
- data/lib/vmc/cli/service/service.rb +42 -0
- data/lib/vmc/cli/service/services.rb +115 -0
- data/lib/vmc/cli/service/unbind.rb +38 -0
- data/lib/vmc/cli/space/base.rb +21 -0
- data/lib/vmc/cli/space/create.rb +56 -0
- data/lib/vmc/cli/space/delete.rb +95 -0
- data/lib/vmc/cli/space/rename.rb +39 -0
- data/lib/vmc/cli/space/space.rb +64 -0
- data/lib/vmc/cli/space/spaces.rb +55 -0
- data/lib/vmc/cli/space/take.rb +16 -0
- data/lib/vmc/cli/start/base.rb +80 -0
- data/lib/vmc/cli/start/colors.rb +13 -0
- data/lib/vmc/cli/start/info.rb +122 -0
- data/lib/vmc/cli/start/login.rb +92 -0
- data/lib/vmc/cli/start/logout.rb +13 -0
- data/lib/vmc/cli/start/target.rb +64 -0
- data/lib/vmc/cli/start/target_interactions.rb +37 -0
- data/lib/vmc/cli/start/targets.rb +16 -0
- data/lib/vmc/cli/user/base.rb +29 -0
- data/lib/vmc/cli/user/create.rb +39 -0
- data/lib/vmc/cli/user/delete.rb +25 -0
- data/lib/vmc/cli/user/passwd.rb +50 -0
- data/lib/vmc/cli/user/register.rb +42 -0
- data/lib/vmc/cli/user/users.rb +32 -0
- data/lib/vmc/constants.rb +13 -0
- data/lib/vmc/detect.rb +134 -0
- data/lib/vmc/errors.rb +17 -0
- data/lib/vmc/plugin.rb +56 -0
- data/lib/vmc/spacing.rb +89 -0
- data/lib/vmc/spec_helper.rb +1 -0
- data/lib/vmc/test_support.rb +4 -0
- data/lib/vmc/test_support/command_helper.rb +32 -0
- data/lib/vmc/test_support/common_input_examples.rb +14 -0
- data/lib/vmc/test_support/fake_home_dir.rb +16 -0
- data/lib/vmc/test_support/interact_helper.rb +29 -0
- data/lib/vmc/version.rb +3 -0
- data/spec/assets/hello-sinatra/Gemfile +3 -0
- data/spec/assets/hello-sinatra/main.rb +6 -0
- data/spec/features/new_user_flow_spec.rb +71 -0
- data/spec/spec_helper.rb +63 -0
- data/spec/vmc/cli/app/base_spec.rb +17 -0
- data/spec/vmc/cli/app/delete_spec.rb +188 -0
- data/spec/vmc/cli/app/instances_spec.rb +65 -0
- data/spec/vmc/cli/app/push/create_spec.rb +571 -0
- data/spec/vmc/cli/app/push_spec.rb +369 -0
- data/spec/vmc/cli/app/rename_spec.rb +104 -0
- data/spec/vmc/cli/app/scale_spec.rb +81 -0
- data/spec/vmc/cli/app/stats_spec.rb +62 -0
- data/spec/vmc/cli/domain/map_spec.rb +140 -0
- data/spec/vmc/cli/domain/unmap_spec.rb +73 -0
- data/spec/vmc/cli/organization/orgs_spec.rb +108 -0
- data/spec/vmc/cli/organization/rename_spec.rb +113 -0
- data/spec/vmc/cli/route/map_spec.rb +138 -0
- data/spec/vmc/cli/route/unmap_spec.rb +215 -0
- data/spec/vmc/cli/service/bind_spec.rb +25 -0
- data/spec/vmc/cli/service/delete_spec.rb +22 -0
- data/spec/vmc/cli/service/rename_spec.rb +105 -0
- data/spec/vmc/cli/service/service_spec.rb +23 -0
- data/spec/vmc/cli/service/unbind_spec.rb +25 -0
- data/spec/vmc/cli/space/rename_spec.rb +102 -0
- data/spec/vmc/cli/space/spaces_spec.rb +104 -0
- data/spec/vmc/cli/start/info_spec.rb +153 -0
- data/spec/vmc/cli/start/login_spec.rb +71 -0
- data/spec/vmc/cli/user/create_spec.rb +54 -0
- data/spec/vmc/cli/user/passwd_spec.rb +102 -0
- data/spec/vmc/cli/user/register_spec.rb +148 -0
- data/spec/vmc/cli_spec.rb +448 -0
- data/spec/vmc/detect_spec.rb +54 -0
- metadata +231 -124
- data/README.md +0 -155
- data/caldecott_helper/Gemfile +0 -10
- data/caldecott_helper/Gemfile.lock +0 -48
- data/caldecott_helper/server.rb +0 -43
- data/config/clients.yml +0 -17
- data/config/micro/offline.conf +0 -2
- data/config/micro/paths.yml +0 -22
- data/config/micro/refresh_ip.rb +0 -20
- data/lib/cli.rb +0 -48
- data/lib/cli/commands/admin.rb +0 -81
- data/lib/cli/commands/apps.rb +0 -1358
- data/lib/cli/commands/base.rb +0 -233
- data/lib/cli/commands/manifest.rb +0 -56
- data/lib/cli/commands/micro.rb +0 -115
- data/lib/cli/commands/misc.rb +0 -147
- data/lib/cli/commands/services.rb +0 -217
- data/lib/cli/commands/user.rb +0 -70
- data/lib/cli/config.rb +0 -176
- data/lib/cli/console_helper.rb +0 -163
- data/lib/cli/core_ext.rb +0 -122
- data/lib/cli/errors.rb +0 -19
- data/lib/cli/file_helper.rb +0 -123
- data/lib/cli/frameworks.rb +0 -265
- data/lib/cli/manifest_helper.rb +0 -316
- data/lib/cli/runner.rb +0 -633
- data/lib/cli/services_helper.rb +0 -104
- data/lib/cli/tunnel_helper.rb +0 -336
- data/lib/cli/usage.rb +0 -129
- data/lib/cli/version.rb +0 -7
- data/lib/cli/zip_util.rb +0 -102
- data/lib/vmc/client.rb +0 -574
- data/lib/vmc/const.rb +0 -27
- data/lib/vmc/micro.rb +0 -56
- data/lib/vmc/micro/switcher/base.rb +0 -97
- data/lib/vmc/micro/switcher/darwin.rb +0 -19
- data/lib/vmc/micro/switcher/dummy.rb +0 -15
- data/lib/vmc/micro/switcher/linux.rb +0 -16
- data/lib/vmc/micro/switcher/windows.rb +0 -31
- data/lib/vmc/micro/vmrun.rb +0 -158
@@ -0,0 +1,27 @@
|
|
1
|
+
require "vmc/cli/app/base"
|
2
|
+
|
3
|
+
module VMC::App
|
4
|
+
class Stop < Base
|
5
|
+
desc "Stop an application"
|
6
|
+
group :apps, :manage
|
7
|
+
input :apps, :desc => "Applications to start", :argument => :splat,
|
8
|
+
:singular => :app, :from_given => by_name(:app)
|
9
|
+
input :all, :desc => "Stop all applications", :default => false
|
10
|
+
def stop
|
11
|
+
apps = input[:all] ? client.apps : input[:apps]
|
12
|
+
fail "No applications given." if apps.empty?
|
13
|
+
|
14
|
+
apps.each do |app|
|
15
|
+
with_progress("Stopping #{c(app.name, :name)}") do |s|
|
16
|
+
if app.stopped?
|
17
|
+
s.skip do
|
18
|
+
err "Application is not running."
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
app.stop!
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "vmc/cli/domain/base"
|
2
|
+
|
3
|
+
module VMC::Domain
|
4
|
+
class Domains < Base
|
5
|
+
desc "List domains in a space"
|
6
|
+
group :domains, :hidden => true
|
7
|
+
input :space, :desc => "Space to list the domains from",
|
8
|
+
:argument => :optional, :default => proc { client.current_space },
|
9
|
+
:from_given => by_name(:space)
|
10
|
+
input :all, :desc => "List all domains", :default => false
|
11
|
+
def domains
|
12
|
+
space = input[:space]
|
13
|
+
|
14
|
+
domains =
|
15
|
+
if input[:all]
|
16
|
+
with_progress("Getting all domains") do
|
17
|
+
client.domains
|
18
|
+
end
|
19
|
+
else
|
20
|
+
with_progress("Getting domains in #{c(space.name, :name)}") do
|
21
|
+
space.domains
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
line unless quiet?
|
26
|
+
|
27
|
+
table(
|
28
|
+
%w{name owner},
|
29
|
+
domains.sort_by(&:name).collect { |r|
|
30
|
+
[c(r.name, :name),
|
31
|
+
if org = r.owning_organization
|
32
|
+
c(org.name, :name)
|
33
|
+
else
|
34
|
+
d("none")
|
35
|
+
end
|
36
|
+
]
|
37
|
+
})
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "vmc/cli/domain/base"
|
2
|
+
|
3
|
+
module VMC::Domain
|
4
|
+
class Map < Base
|
5
|
+
desc "Map a domain to an organization or space"
|
6
|
+
group :domains, :hidden => true
|
7
|
+
input :name, :desc => "Domain to map", :argument => :required
|
8
|
+
input :organization, :desc => "Organization to map the domain to",
|
9
|
+
:aliases => %w{--org -o},
|
10
|
+
:default => proc { client.current_organization },
|
11
|
+
:from_given => by_name(:organization)
|
12
|
+
input :space, :desc => "Space to map the domain to",
|
13
|
+
:default => proc { client.current_space },
|
14
|
+
:from_given => by_name(:space)
|
15
|
+
input :shared, :desc => "Create a shared domain", :default => false
|
16
|
+
def map_domain
|
17
|
+
domain = client.domain_by_name(input[:name])
|
18
|
+
|
19
|
+
given_org = input.has?(:organization)
|
20
|
+
given_space = input.has?(:space)
|
21
|
+
|
22
|
+
org = input[:organization]
|
23
|
+
space = input[:space]
|
24
|
+
|
25
|
+
given_space = true unless given_org || given_space
|
26
|
+
|
27
|
+
unless domain
|
28
|
+
domain = client.domain
|
29
|
+
domain.name = input[:name]
|
30
|
+
domain.owning_organization = org unless input[:shared]
|
31
|
+
domain.wildcard = true
|
32
|
+
|
33
|
+
with_progress("Creating domain #{c(domain.name, :name)}") do
|
34
|
+
domain.create!
|
35
|
+
org.add_domain(domain) if org && !given_org && !given_space
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
if given_space
|
40
|
+
add_domain(domain, space.organization)
|
41
|
+
add_domain(domain, space)
|
42
|
+
elsif given_org
|
43
|
+
add_domain(domain, org)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def add_domain(domain, target)
|
50
|
+
with_progress("Mapping #{c(domain.name, :name)} to #{c(target.name, :name)}") do
|
51
|
+
target.add_domain(domain)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "vmc/cli/domain/base"
|
2
|
+
|
3
|
+
module VMC::Domain
|
4
|
+
class Unmap < Base
|
5
|
+
desc "Unmap a domain from an organization or space"
|
6
|
+
group :domains, :hidden => true
|
7
|
+
input :domain, :desc => "Domain to unmap", :argument => :required,
|
8
|
+
:from_given => by_name("domain")
|
9
|
+
input :organization, :desc => "Organization to unmap the domain from",
|
10
|
+
:aliases => %w{--org -o},
|
11
|
+
:default => proc { client.current_organization },
|
12
|
+
:from_given => by_name(:organization)
|
13
|
+
input :space, :desc => "Space to unmap the domain from",
|
14
|
+
:default => proc { client.current_space },
|
15
|
+
:from_given => by_name(:space)
|
16
|
+
input :delete, :desc => "Delete domain", :type => :boolean
|
17
|
+
input :really, :type => :boolean, :forget => true, :hidden => true,
|
18
|
+
:default => proc { force? || interact }
|
19
|
+
def unmap_domain
|
20
|
+
domain = input[:domain]
|
21
|
+
|
22
|
+
given_org = input.has?(:organization)
|
23
|
+
given_space = input.has?(:space)
|
24
|
+
|
25
|
+
org = input[:organization]
|
26
|
+
space = input[:space]
|
27
|
+
|
28
|
+
if input[:delete]
|
29
|
+
return unless input[:really, domain.name, :name]
|
30
|
+
|
31
|
+
with_progress("Deleting domain #{c(domain.name, :name)}") do
|
32
|
+
domain.delete!
|
33
|
+
end
|
34
|
+
|
35
|
+
return
|
36
|
+
end
|
37
|
+
|
38
|
+
given_space = true unless given_org || given_space
|
39
|
+
|
40
|
+
remove_domain(domain, space) if given_space
|
41
|
+
remove_domain(domain, org) if given_org
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def remove_domain(domain, target)
|
47
|
+
with_progress("Unmapping #{c(domain.name, :name)} from #{c(target.name, :name)}") do
|
48
|
+
target.remove_domain(domain)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def ask_really(name, color)
|
53
|
+
ask("Really delete #{c(name, color)}?", :default => false)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/vmc/cli/help.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "mothership/help"
|
2
|
+
|
3
|
+
Mothership::Help.groups(
|
4
|
+
[:start, "Getting Started"],
|
5
|
+
[:apps, "Applications",
|
6
|
+
[:manage, "Management"],
|
7
|
+
[:info, "Information"]],
|
8
|
+
[:services, "Services",
|
9
|
+
[:manage, "Management"]],
|
10
|
+
[:organizations, "Organizations"],
|
11
|
+
[:spaces, "Spaces"],
|
12
|
+
[:routes, "Routes"],
|
13
|
+
[:system, "System"],
|
14
|
+
[:domains, "Domains"],
|
15
|
+
[:admin, "Administration",
|
16
|
+
[:user, "User Management"]])
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require "interact"
|
2
|
+
require "interact/pretty"
|
3
|
+
require "interact/progress"
|
4
|
+
|
5
|
+
module VMC
|
6
|
+
module Interactive
|
7
|
+
include ::Interactive::Rewindable
|
8
|
+
include Interact::Pretty
|
9
|
+
include Interact::Progress
|
10
|
+
|
11
|
+
def ask(question, options = {})
|
12
|
+
if force? and options.key?(:default)
|
13
|
+
options[:default]
|
14
|
+
else
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def list_choices(choices, options = {})
|
20
|
+
choices.each_with_index do |o, i|
|
21
|
+
puts "#{c(i + 1, :number)}: #{show_choice(o, options)}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def input_state(options)
|
26
|
+
if options.key? :default
|
27
|
+
answer = show_default(options)
|
28
|
+
end
|
29
|
+
|
30
|
+
CFState.new(options, answer)
|
31
|
+
end
|
32
|
+
|
33
|
+
def show_default(options)
|
34
|
+
case options[:default]
|
35
|
+
when true
|
36
|
+
"y"
|
37
|
+
when false
|
38
|
+
"n"
|
39
|
+
when nil
|
40
|
+
""
|
41
|
+
else
|
42
|
+
show_choice(options[:default], options)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def prompt(question, options)
|
47
|
+
value = show_default(options)
|
48
|
+
|
49
|
+
print "#{question}"
|
50
|
+
print c("> ", :prompt)
|
51
|
+
|
52
|
+
unless value.empty?
|
53
|
+
print "#{d(value) + "\b" * value.size}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def handler(event, state)
|
58
|
+
ans = state.answer
|
59
|
+
pos = state.position
|
60
|
+
|
61
|
+
exit if event == :eof
|
62
|
+
|
63
|
+
if state.default?
|
64
|
+
if event.is_a?(Array) and event[0] == :key
|
65
|
+
# initial non-movement keypress clears default answer
|
66
|
+
clear_input(state)
|
67
|
+
else
|
68
|
+
# wipe away any coloring
|
69
|
+
redraw_input(state)
|
70
|
+
end
|
71
|
+
|
72
|
+
state.clear_default!
|
73
|
+
|
74
|
+
# tab with a default accepts it and moves to the end
|
75
|
+
if event == :tab
|
76
|
+
state.goto(ans.size)
|
77
|
+
else
|
78
|
+
super
|
79
|
+
end
|
80
|
+
else
|
81
|
+
super
|
82
|
+
end
|
83
|
+
|
84
|
+
print "\n" if event == :enter
|
85
|
+
end
|
86
|
+
|
87
|
+
class CFState < ::Interactive::InputState
|
88
|
+
def initialize(options = {}, answer = nil, position = 0)
|
89
|
+
@options = options
|
90
|
+
@answer = answer || ""
|
91
|
+
@default = options.key? :default
|
92
|
+
@position = position
|
93
|
+
@done = false
|
94
|
+
end
|
95
|
+
|
96
|
+
def clear_default!
|
97
|
+
@default = false
|
98
|
+
end
|
99
|
+
|
100
|
+
def default?
|
101
|
+
@default
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "vmc/cli/organization/base"
|
2
|
+
|
3
|
+
module VMC::Organization
|
4
|
+
class Create < Base
|
5
|
+
desc "Create an organization"
|
6
|
+
group :organizations, :hidden => true
|
7
|
+
input :name, :desc => "Organization name", :argument => :optional
|
8
|
+
input :target, :desc => "Switch to the organization after creation",
|
9
|
+
:alias => "-t", :default => true
|
10
|
+
input :add_self, :desc => "Add yourself to the organization",
|
11
|
+
:default => true
|
12
|
+
def create_org
|
13
|
+
org = client.organization
|
14
|
+
org.name = input[:name]
|
15
|
+
org.users = [client.current_user] if input[:add_self]
|
16
|
+
|
17
|
+
with_progress("Creating organization #{c(org.name, :name)}") do
|
18
|
+
org.create!
|
19
|
+
end
|
20
|
+
|
21
|
+
if input[:target]
|
22
|
+
invoke :target, :organization => org
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def ask_name
|
29
|
+
ask("Name")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "vmc/cli/organization/base"
|
2
|
+
|
3
|
+
module VMC::Organization
|
4
|
+
class Delete < Base
|
5
|
+
desc "Delete an organization"
|
6
|
+
group :organizations, :hidden => true
|
7
|
+
input :organization, :desc => "Organization to delete",
|
8
|
+
:aliases => %w{--org -o}, :argument => :optional,
|
9
|
+
:from_given => by_name(:organization)
|
10
|
+
input :recursive, :desc => "Delete recursively", :alias => "-r",
|
11
|
+
:default => false, :forget => true
|
12
|
+
input :warn, :desc => "Show warning if it was the last org",
|
13
|
+
:default => true
|
14
|
+
input :really, :type => :boolean, :forget => true, :hidden => true,
|
15
|
+
:default => proc { force? || interact }
|
16
|
+
def delete_org
|
17
|
+
org = input[:organization]
|
18
|
+
return unless input[:really, org]
|
19
|
+
|
20
|
+
spaces = org.spaces
|
21
|
+
unless spaces.empty?
|
22
|
+
unless force?
|
23
|
+
line "This organization is not empty!"
|
24
|
+
line
|
25
|
+
line "spaces: #{name_list(spaces)}"
|
26
|
+
line
|
27
|
+
|
28
|
+
return unless input[:recursive]
|
29
|
+
end
|
30
|
+
|
31
|
+
spaces.each do |s|
|
32
|
+
invoke :delete_space, :space => s, :really => true,
|
33
|
+
:recursive => true, :warn => false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
is_current = org == client.current_organization
|
38
|
+
|
39
|
+
with_progress("Deleting organization #{c(org.name, :name)}") do
|
40
|
+
org.delete!
|
41
|
+
end
|
42
|
+
|
43
|
+
if orgs.size == 1
|
44
|
+
return unless input[:warn]
|
45
|
+
|
46
|
+
line
|
47
|
+
line c("There are no longer any organizations.", :warning)
|
48
|
+
line "You may want to create one with #{c("create-org", :good)}."
|
49
|
+
elsif is_current
|
50
|
+
invalidate_target
|
51
|
+
invoke :target
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def ask_organization
|
58
|
+
orgs = client.organizations
|
59
|
+
fail "No organizations." if orgs.empty?
|
60
|
+
|
61
|
+
ask("Which organization", :choices => orgs.sort_by(&:name),
|
62
|
+
:display => proc(&:name))
|
63
|
+
end
|
64
|
+
|
65
|
+
def ask_really(org)
|
66
|
+
ask("Really delete #{c(org.name, :name)}?", :default => false)
|
67
|
+
end
|
68
|
+
|
69
|
+
def ask_recursive
|
70
|
+
ask "Delete #{c("EVERYTHING", :bad)}?", :default => false
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require "vmc/cli/organization/base"
|
2
|
+
|
3
|
+
module VMC::Organization
|
4
|
+
class Org < Base
|
5
|
+
desc "Show organization information"
|
6
|
+
group :organizations, :hidden => true
|
7
|
+
input :organization, :desc => "Organization to show",
|
8
|
+
:aliases => %w{--org -o}, :argument => :optional,
|
9
|
+
:from_given => by_name(:organization),
|
10
|
+
:default => proc { client.current_organization }
|
11
|
+
input :full, :desc => "Show full information for spaces, domains, etc.",
|
12
|
+
:default => false
|
13
|
+
def org
|
14
|
+
org = input[:organization]
|
15
|
+
|
16
|
+
unless org
|
17
|
+
return if quiet?
|
18
|
+
fail "No current organization."
|
19
|
+
end
|
20
|
+
|
21
|
+
if quiet?
|
22
|
+
puts org.name
|
23
|
+
return
|
24
|
+
end
|
25
|
+
|
26
|
+
line "#{c(org.name, :name)}:"
|
27
|
+
|
28
|
+
indented do
|
29
|
+
line "domains: #{name_list(org.domains)}"
|
30
|
+
|
31
|
+
if input[:full]
|
32
|
+
line "spaces:"
|
33
|
+
|
34
|
+
spaced(org.spaces(:depth => 2)) do |s|
|
35
|
+
indented do
|
36
|
+
invoke :space, :space => s
|
37
|
+
end
|
38
|
+
end
|
39
|
+
else
|
40
|
+
line "spaces: #{name_list(org.spaces)}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|