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-1.3.9 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.3.8 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.3.7 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.1.8 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.3.6 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.1.7 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.3.5 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.3.4 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.1.6 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.3.3 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.3.2 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.1.5 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.3.1 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.3.0 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.1.4 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.2.7 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.2.6 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.2.5 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.2.4 lib/kuber_kit/service_deployer/deployment_options_selector.rb
kuber_kit-1.2.2 lib/kuber_kit/service_deployer/deployment_options_selector.rb