# File lib/rhc/commands/domain.rb, line 12 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 app create' command" end 0 end
# File lib/rhc/commands/domain.rb, line 71 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("Domain contains applications. Delete applications first.", 128) end results { say "Success!" } 0 end
# File lib/rhc/commands/domain.rb, line 45 def show domain = rest_client.domains.first display_domain(domain) 0 end
# File lib/rhc/commands/domain.rb, line 54 def status args = [] options.__hash__.each do |key, value| value = value.to_s if value.length > 0 && value.to_s.strip.length == 0; value = "'#{value}'" end args << "--#{key} #{value}" end Kernel.system("rhc-chk #{args.join(' ')} 2>&1") $?.exitstatus.nil? ? 1 : $?.exitstatus end
# File lib/rhc/commands/domain.rb, line 29 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) results do say "Success!" say "You can use 'rhc domain show' to view any url changes. Be sure to update any links including the url in your local git config: <local_git_repo>/.git/config" end 0 end