Sha256: 9a47e823d930c14fbab0fad43aa1954c0a96286307275d771a00df106cefad1b

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Command
  class SetupApp < Base
    NAME = "setup-app"
    OPTIONS = [
      app_option(required: true)
    ].freeze
    DESCRIPTION = "Creates an app and all its workloads"
    LONG_DESCRIPTION = <<~DESC
      - Creates an app and all its workloads
      - Specify the templates for the app and workloads through `setup` in the `.controlplane/controlplane.yml` file
      - This should should only be used for temporary apps like review apps, never for persistent apps like production (to update workloads for those, use 'cpl apply-template' instead)
    DESC

    def call
      templates = config[:setup]

      app = cp.fetch_gvc
      if app
        raise "App '#{config.app}' already exists. If you want to update this app, " \
              "either run 'cpl delete -a #{config.app}' and then re-run this command, " \
              "or run 'cpl apply-template #{templates.join(' ')} -a #{config.app}'."
      end

      Cpl::Cli.start(["apply-template", *templates, "-a", config.app])
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cpl-1.1.2 lib/command/setup_app.rb
cpl-1.1.2.rc.0 lib/command/setup_app.rb
cpl-1.1.1 lib/command/setup_app.rb
cpl-1.1.0 lib/command/setup_app.rb
cpl-1.0.4 lib/command/setup_app.rb
cpl-1.0.3 lib/command/setup_app.rb
cpl-1.0.2 lib/command/setup_app.rb
cpl-1.0.1 lib/command/setup_app.rb
cpl-1.0.0 lib/command/setup_app.rb
cpl-0.7.0 lib/command/setup_app.rb