# 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
# 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 'rhc create-app' command" 0 end
# 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
# 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
# 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 'rhc setup' or 'rhc 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
# 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 created in this domain will use the new name in their URL." 0 end
# 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 'rhc setup' or 'rhc 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 'rhc create-app' to create a new application." end 0 end
# File lib/rhc/commands/domain.rb, line 160 def check_allowed_gear_sizes raise OptionParser::InvalidOption, "--allowed-gear-sizes and --no-allowed-gear-sizes cannot both be specified" unless options.allowed_gear_sizes.nil? or options.no_allowed_gear_sizes.nil? sizes = options.no_allowed_gear_sizes.nil? ? options.allowed_gear_sizes : false raise OptionParser::InvalidOption, "The server does not support --allowed-gear-sizes" unless sizes.nil? || rest_client.api.has_param?(:add_domain, 'allowed_gear_sizes') if sizes.is_a? String sizes.split(',').map(&:strip).map(&:presence) elsif sizes == false [] elsif sizes raise OptionParser::InvalidOption, "Provide a comma delimited list of valid gear sizes to --allowed-gear-sizes" end end