class RHC::Commands::Domain

Public Instance Methods

create(namespace) click to toggle source
# 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
delete(namespace) click to toggle source
# File lib/rhc/commands/domain.rb, line 78
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
show() click to toggle source
# File lib/rhc/commands/domain.rb, line 45
def show
  domain = rest_client.domains.first

  warn "In order to deploy applications, you must create a domain with 'rhc setup' or 'rhc domain create'." 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 app create' to create a new application."
  end

  0
end
status() click to toggle source

:nocov:

# File lib/rhc/commands/domain.rb, line 69
def status
  1 # return error status
end
update(old_namespace, new_namespace) click to toggle source
# 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