Sha256: bc90130372d7f842dbd7299d7c324839a077da91fccdab3d68ba9cb8dbaef3f0

Contents?: true

Size: 1.31 KB

Versions: 35

Compression:

Stored size: 1.31 KB

Contents

module Aptible
  module CLI
    module Helpers
      module Vhost
        def provision_vhost_and_explain(service, vhost)
          op = vhost.create_operation!(type: 'provision')
          attach_to_operation_logs(op)

          Formatter.render(Renderer.current) do |root|
            root.object do |node|
              ResourceFormatter.inject_vhost(node, vhost.reload, service)
            end
          end
        end

        def find_vhost(service_enumerator, hostname)
          seen = []

          service_enumerator.each do |service|
            service.each_vhost do |vhost|
              seen << vhost.external_host
              return vhost if vhost.external_host == hostname
            end
          end

          e = "Endpoint with hostname #{hostname} does not exist"
          e = "#{e} (valid hostnames: #{seen.join(', ')})" if seen.any?
          raise Thor::Error, e
        end

        def each_service(resource, &block)
          return enum_for(:each_service, resource) if block.nil?
          klass = resource.class

          if klass == Aptible::Api::App
            resource.each_service(&block)
          elsif klass == Aptible::Api::Database
            [resource.service].each(&block)
          else
            raise "Unexpected resource: #{klass}"
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
aptible-cli-0.24.2 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.24.1 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.24.0 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.23.0 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.22.0 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.21.0 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.20.0 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.19.9 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.19.7 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.19.6 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.19.4 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.19.3 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.19.2 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.19.1 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.19.0 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.18.3 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.18.2 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.18.1 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.18.0 lib/aptible/cli/helpers/vhost.rb
aptible-cli-0.17.2 lib/aptible/cli/helpers/vhost.rb