Sha256: 7e69403fcc2164377788efc3c4c00b89855b4a125c6c4321336bdee641ea27d2

Contents?: true

Size: 1.74 KB

Versions: 12

Compression:

Stored size: 1.74 KB

Contents

# frozen_string_literal: true

require 'avm/path_string'
require 'eac_ruby_utils/console/docopt_runner'
require 'eac_ruby_utils/console/speaker'

module Avm
  module Stereotypes
    module EacWebappBase0
      module Runner
        class Deploy < ::EacRubyUtils::Console::DocoptRunner
          include ::EacRubyUtils::Console::Speaker

          DOC = <<~DOCOPT
            Deploy for %%STEREOTYPE_NAME%% instance.

            Usage:
              __PROGRAM__ [options]
              __PROGRAM__ -h | --help

            Options:
              -h --help                       Show this screen.
              -r --reference=<git-reference>  Git reference to deploy.
              -a --append-dirs=<append-dirs>  Append directories to deploy (List separated by ":").
          DOCOPT
          def initialize(settings = {})
            super settings.merge(doc: DOC.gsub('%%STEREOTYPE_NAME%%', stereotype_name))
          end

          def deploy_class
            stereotype_module.const_get('Deploy')
          end

          def stereotype_module
            ::Avm::Stereotypes.const_get(stereotype_name)
          rescue ::NameError
            ::Avm.const_get(stereotype_name)
          end

          def stereotype_name
            self.class.name.deconstantize.demodulize
          end

          def run
            result = deploy_class.new(context(:instance), deploy_options).run
            if result.error?
              fatal_error result.to_s
            else
              infov 'Result', result.label
            end
          end

          def deploy_options
            { reference: options.fetch('--reference'),
              appended_directories: ::Avm::PathString.paths(options.fetch('--append-dirs')) }
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
avm-tools-0.68.0 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.67.0 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.66.0 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.65.0 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.64.2 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.64.1 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.64.0 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.63.0 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.62.4 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.62.3 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.62.2 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
avm-tools-0.62.1 lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb