# File lib/rhc/commands/domain.rb, line 23 def create(namespace) paragraph { say "Creating domain with namespace '#{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 87 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 54 def show domain = 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) if applications.present? header "Applications in #{domain.id} domain" do applications.each do |a| display_app(a,a.cartridges) end end success "You have #{applications.length} applications 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 78 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 "Changing namespace '#{domain.id}' to '#{new_namespace}' ... " domain.update(new_namespace) success "success" info "Applications in this domain will use the new namespace in their URL." 0 end