Class: RHC::Commands::Domain
- Inherits:
-
Base
show all
- Defined in:
- lib/rhc/commands/domain.rb
Constant Summary
Constants included
from Helpers
Helpers::BOUND_WARNING, Helpers::PREFIX, Helpers::ROLES
Instance Method Summary
collapse
Methods inherited from Base
#initialize
#find_app, #find_domain, #find_membership_container, #find_team, #from_local_git, included, #namespace_context, #server_context
Methods included from GitHelpers
#git_clone_application, #git_clone_deploy_hooks, #git_clone_repo, #git_cmd, #git_config_get, #git_config_set, #git_remote_add, #git_version, #has_git?
Methods included from Helpers
#agree, #certificate_file, #client_from_options, #collect_env_vars, #color, #confirm_action, #date, #datetime_rfc3339, #debug, #debug?, #debug_error, #decode_json, #deprecated, #deprecated_command, #disable_deprecated?, #distance_of_time_in_words, #env_var_regex_pattern, #error, #exec, #host_exists?, #hosts_file_contains?, #human_size, #info, #interactive?, #jruby?, #mac?, #openshift_online_server?, #openshift_rest_endpoint, #openshift_server, #openshift_url, #pluralize, #results, #role_name, #run_with_tee, #ssh_string, #ssh_string_parts, #ssl_options, #success, #system_path, #table_heading, #to_host, #to_uri, #token_for_user, #unix?, #user_agent, #warn, #windows?, #with_tolerant_encoding
#default_display_env_var, #display_app, #display_app_configurations, #display_authorization, #display_cart, #display_cart_storage_info, #display_cart_storage_list, #display_deployment, #display_deployment_list, #display_domain, #display_env_var_list, #display_key, #display_team, #format_cart_gears, #format_cart_header, #format_gear_info, #format_key_header, #format_scaling_info, #format_usage_message
Instance Method Details
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/rhc/commands/domain.rb', line 75
def configure(_)
domain = find_domain
payload = {}
payload[:allowed_gear_sizes] = check_allowed_gear_sizes unless options.allowed_gear_sizes.nil? and options.no_allowed_gear_sizes.nil?
if payload.present?
say "Updating domain configuration ... "
domain.configure(payload)
success "done"
end
paragraph do
say format_table("Domain #{domain.name} configuration", get_properties(domain, :allowed_gear_sizes), :delete => true)
end
0
end
|
#create(namespace) ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/rhc/commands/domain.rb', line 43
def create(namespace)
say "Creating domain '#{namespace}' ... "
rest_client.add_domain(namespace, :allowed_gear_sizes => check_allowed_gear_sizes)
success "done"
info "You may now create an application using the 'app create-app' command"
0
end
|
#delete(_) ⇒ Object
135
136
137
138
139
140
141
142
143
|
# File 'lib/rhc/commands/domain.rb', line 135
def delete(_)
domain = find_domain
say "Deleting domain '#{domain.name}' ... "
domain.destroy(options.force.present?)
success "deleted"
0
end
|
#leave(namespace) ⇒ Object
148
149
150
151
152
153
154
155
156
157
|
# File 'lib/rhc/commands/domain.rb', line 148
def leave(namespace)
domain = rest_client.find_domain(namespace)
say "Leaving domain ... "
result = domain.leave
success "done"
result.messages.each{ |s| paragraph{ say s } }
0
end
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/rhc/commands/domain.rb', line 116
def list
domains = rest_client.send(options.mine ? :owned_domains : :domains)
warn "In order to deploy applications, you must create a domain with 'app setup' or 'app create-domain'." and return 1 unless domains.present?
warn "The --ids option is deprecated. Domain IDs are displayed by default." if options.ids
domains.each do |d|
display_domain(d, nil, true)
end
success "You have access to #{pluralize(domains.length, 'domain')}."
0
end
|
#rename(old_namespace, new_namespace) ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/rhc/commands/domain.rb', line 58
def rename(old_namespace, new_namespace)
domain = rest_client.find_domain(old_namespace)
say "Renaming domain '#{domain.name}' to '#{new_namespace}' ... "
domain.rename(new_namespace)
success "done"
info "Applications in this domain will use the new name in their URL."
0
end
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/rhc/commands/domain.rb', line 95
def show(_)
domain = find_domain
warn "In order to deploy applications, you must create a domain with 'app setup' or 'app create-domain'." and return 1 unless domain
applications = domain.applications(:include => :cartridges)
display_domain(domain, applications, true)
if applications.present?
success "You have #{pluralize(applications.length, 'application')} in your domain."
else
success "The domain #{domain.name} exists but has no applications. You can use 'app create-app' to create a new application."
end
0
end
|