# File lib/rhc/commands/domain.rb, line 23 def create(namespace) paragraph { say "Creating domain '#{namespace}'" } rest_client.add_domain(namespace) results do say "Success!" say "You may now create an application using the 'rhc create-app' command" end 0 end
# File lib/rhc/commands/domain.rb, line 101 def delete(namespace) domain = rest_client.find_domain namespace say "Deleting domain '#{namespace}' ... " begin domain.destroy rescue RHC::Rest::ClientErrorException #FIXME: I am insufficiently specific raise RHC::Exception.new("Your domain contains applications. Delete applications first.", 128) end success "deleted" 0 end
# File lib/rhc/commands/domain.rb, line 75 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? domains.each do |d| display_domain(d) end success "You have access to #{pluralize(domains.length, 'domain')}." 0 end
# File lib/rhc/commands/domain.rb, line 55 def show(namespace) domain = (rest_client.find_domain(namespace) if namespace) || rest_client.domains.first 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) if applications.present? success "You have #{pluralize(applications.length, 'application')} in your domain." else success "The domain #{domain.id} exists but has no applications. You can use 'rhc create-app' to create a new application." end 0 end
:nocov:
# File lib/rhc/commands/domain.rb, line 92 def status 1 # return error status end
# File lib/rhc/commands/domain.rb, line 40 def update(old_namespace, new_namespace) domain = rest_client.find_domain(old_namespace) say "Renaming domain '#{domain.id}' to '#{new_namespace}' ... " domain.update(new_namespace) success "done" info "Applications in this domain will use the new name in their URL." 0 end