Sha256: fccf5f5f44a3bf875b5eff5a62f218114989b09fd84c41ccc891d09ced0af62b

Contents?: true

Size: 960 Bytes

Versions: 2

Compression:

Stored size: 960 Bytes

Contents

require 'shellwords'

module Aptible
  module CLI
    module Subcommands
      module Domains
        def self.included(thor)
          thor.class_eval do
            include Helpers::Operation
            include Helpers::App

            desc 'domains', "Print an app's current virtual domains"
            option :app
            option :verbose, aliases: '-v'
            option :remote, aliases: '-r'
            def domains
              app = ensure_app(options)
              print_vhosts(app) do |vhost|
                if options[:verbose]
                  "#{vhost.virtual_domain} -> #{vhost.external_host}"
                else
                  vhost.virtual_domain
                end
              end
            end

            private

            def print_vhosts(app)
              (app.vhosts || []).each do |vhost|
                say yield(vhost)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aptible-cli-0.5.15 lib/aptible/cli/subcommands/domains.rb
aptible-cli-0.5.14 lib/aptible/cli/subcommands/domains.rb