Sha256: 5de9e566159a5353d82ac1da3476d346da817a0caa88a981d9b3a791703887d2

Contents?: true

Size: 1.06 KB

Versions: 52

Compression:

Stored size: 1.06 KB

Contents

class KuberKit::ServiceDeployer::DeploymentOptionsSelector
  include KuberKit::Import[
    "core.service_store",
    "ui"
  ]

  OPTION_SPECIFIC_SERVICE = "deploy specific service".freeze
  OPTION_ALL_SERVICES     = "deploy all services"

  def call()
    tags = [OPTION_SPECIFIC_SERVICE, OPTION_ALL_SERVICES]
    tags += service_store
      .all_definitions
      .values
      .map(&:to_service_attrs)
      .map(&:tags)
      .flatten
      .uniq
      .sort
      .map(&:to_s)

    selected_tag = ui.prompt("Please select which tag to deploy", tags)

    if selected_tag == OPTION_SPECIFIC_SERVICE
      show_service_selection
    elsif selected_tag == OPTION_ALL_SERVICES
      [["*"], []]
    else
      [[], [selected_tag]]
    end
  end

  def show_service_selection()
    services = service_store
      .all_definitions
      .values
      .map(&:service_name)
      .uniq
      .sort
      .map(&:to_s)

    if services.empty?
      return [[], []]
    end

    selected_service = ui.prompt("Please select which service to deploy", services)
    [[selected_service], []]
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
kuber_kit-0.8.4 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.8.3 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.8.2 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.8.1 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.8.0 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.7.1 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.7.0 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.6.4 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.6.3 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.6.2 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.6.1 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-0.6.0 lib/kuber_kit/service_deployer/deployment_options_selector.rb