Sha256: 5c645be8173fbdf1c0cdbcf1ebf72c19856d44acfe254b8e8ad38f13383d03ed

Contents?: true

Size: 733 Bytes

Versions: 7

Compression:

Stored size: 733 Bytes

Contents

require "vmc/cli/domain/base"

module VMC::Domain
  class AddDomain < Base
    desc "Add a domain to a space"
    group :domains
    input :name, :desc => "Domain to add", :argument => :required
    input :space, :desc => "Space to add the domain to",
          :default => proc { client.current_space },
          :from_given => by_name(:space)
    def add_domain
      space = input[:space]
      name = input[:name].sub(/^\*\./, "")

      org = space.organization

      domain = org.domains.find { |d| d.name == name } ||
        invoke(:create_domain, :org => org, :name => name)

      with_progress("Adding #{c(domain.name, :name)} to #{c(space.name, :name)}") do
        space.add_domain(domain)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vmc-0.5.0.beta.7 lib/vmc/cli/domain/add_domain.rb
vmc-0.5.0.beta.6 lib/vmc/cli/domain/add_domain.rb
vmc-0.5.0.beta.5 lib/vmc/cli/domain/add_domain.rb
vmc-0.5.0.beta.4 lib/vmc/cli/domain/add_domain.rb
vmc-0.5.0.beta.3 lib/vmc/cli/domain/add_domain.rb
vmc-0.5.0.beta.2 lib/vmc/cli/domain/add_domain.rb
vmc-0.5.0.beta.1 lib/vmc/cli/domain/add_domain.rb