Sha256: 0becf0e51dc02490fa1bc788c572bc464f16be65caa37eed67e337b2ea755996

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

module AcquiaToolbelt
  class CLI
    class Environments < AcquiaToolbelt::Thor
      # Public: List environments on a subscription.
      #
      # Output environment information.
      #
      # Returns enviroment data.
      desc "list", "List all environment data."
      def list
        if options[:subscription]
          subscription = options[:subscription]
        else
          subscription = AcquiaToolbelt::CLI::API.default_subscription
        end

        environment = options[:environment]

        # If the environment option is set, just fetch a single environment.
        if environment
          environments = [environment]
        else
          environments = AcquiaToolbelt::CLI::API.get_environments
        end

        environments.each do |environment|
          env_info = AcquiaToolbelt::CLI::API.request "sites/#{subscription}/envs/#{environment}"
          ui.say
          ui.say "> Host: #{env_info["ssh_host"]}"
          ui.say "> Environment: #{env_info["name"]}"
          ui.say "> Current release: #{env_info["vcs_path"]}"
          ui.say "> DB clusters: #{env_info["db_clusters"].to_s unless env_info["db_clusters"].nil?}"
          ui.say "> Default domain: #{env_info["default_domain"]}"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acquia_toolbelt-2.0.1 lib/acquia_toolbelt/cli/environment.rb
acquia_toolbelt-2.0.0 lib/acquia_toolbelt/cli/environment.rb