Sha256: de13dc68694dd913c62fc27310b103694f352f1fdb67b1c7e319e1acb7b7b073

Contents?: true

Size: 1.88 KB

Versions: 4

Compression:

Stored size: 1.88 KB

Contents

# frozen_string_literal: true

require 'avm/instances/runner'
require 'avm/path_string'
require 'eac_cli/core_ext'

module Avm
  module EacWebappBase0
    module Instances
      module Runners
        class Deploy
          runner_with :help do
            desc 'Deploy for instance.'
            arg_opt '-r', '--reference', 'Git reference to deploy.'
            arg_opt '-a', '--append-dirs', 'Append directories to deploy (List separated by ":").'
            bool_opt '-T', '--no-request-test', 'Do not test web interface after deploy.'
            bool_opt '--no-remote', 'Shortcut to "--no-remote-read --no-remote-write"'
            bool_opt '--no-remote-read', 'Do not attempt to read on remote repository.'
            bool_opt '--no-remote-write', 'Do not attempt to write on remote repository.'
          end

          def deploy_class
            runner_context.call(:stereotype_module).const_get('Instances').const_get('Deploy')
          rescue ::NameError
            runner_context.call(:stereotype_module).const_get('Deploy')
          end

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

          def deploy_options
            { reference: parsed.reference,
              appended_directories: ::Avm::PathString.paths(parsed.append_dirs),
              no_request_test: parsed.no_request_test?, remote_read: remote_read?,
              remote_write: remote_write? }
          end

          # @return [Boolean]
          def remote_read?
            !(parsed.no_remote_read? || parsed.no_remote?)
          end

          # @return [Boolean]
          def remote_write?
            !(parsed.no_remote_write? || parsed.no_remote?)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
avm-eac_webapp_base0-0.20.1 lib/avm/eac_webapp_base0/instances/runners/deploy.rb
eac_tools-0.94.0 sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/deploy.rb
avm-eac_webapp_base0-0.20.0 lib/avm/eac_webapp_base0/instances/runners/deploy.rb
eac_tools-0.93.0 sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/deploy.rb