Sha256: 4aeb2d6b8734d5f91602e63c15c1cb5d8f686fdbe865d5e86b190432bec4e37f

Contents?: true

Size: 1.63 KB

Versions: 11

Compression:

Stored size: 1.63 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 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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
avm-tools-0.74.0 lib/avm/eac_webapp_base0/runner/deploy.rb
avm-tools-0.73.0 lib/avm/eac_webapp_base0/runner/deploy.rb
avm-tools-0.72.0 lib/avm/eac_webapp_base0/runner/deploy.rb
avm-tools-0.71.0 lib/avm/eac_webapp_base0/runner/deploy.rb
avm-tools-0.70.2 lib/avm/eac_webapp_base0/runner/deploy.rb
avm-tools-0.70.1 lib/avm/eac_webapp_base0/runner/deploy.rb
avm-tools-0.70.0 lib/avm/eac_webapp_base0/runner/deploy.rb
avm-tools-0.69.3 lib/avm/eac_webapp_base0/runner/deploy.rb
avm-tools-0.69.2 lib/avm/eac_webapp_base0/runner/deploy.rb
avm-tools-0.69.1 lib/avm/eac_webapp_base0/runner/deploy.rb
avm-tools-0.69.0 lib/avm/eac_webapp_base0/runner/deploy.rb