Sha256: 17c669c25561204a03247e50bf9a43c63d6c1d4f68c21b33e15bda463a4f8805

Contents?: true

Size: 1.3 KB

Versions: 11

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require 'avm/instances/base'
require 'avm/stereotypes/postgresql/instance_with'
require 'avm/data/instance/files_unit'
require 'avm/data/instance/package'
require 'avm/eac_webapp_base0/deploy/file_unit'

module Avm
  module EacWebappBase0
    class Instance < ::Avm::Instances::Base
      include ::Avm::Stereotypes::Postgresql::InstanceWith

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

      def data_dump(argv = [])
        run_subcommand(::Avm::Tools::Runner::EacWordpressBase0::Data::Dump, argv)
      end

      def data_dump_runner_class
        "::Avm::Tools::Runner::#{stereotype_name}::Data::Dump".constantize
      end

      def run_subcommand(subcommand_class, argv)
        parent = ::OpenStruct.new(instance: self)
        subcommand_class.new(argv: argv, parent: parent).run
      end

      def data_package
        @data_package ||= ::Avm::Data::Instance::Package.new(
          self, units: { database: database_unit }.merge(files_units)
        )
      end

      def database_unit
        pg.data_unit
      end

      private

      def files_units
        self.class.const_get('FILES_UNITS').transform_values do |fs_path_subpath|
          ::Avm::Data::Instance::FilesUnit.new(self, fs_path_subpath)
        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/instance.rb
avm-tools-0.73.0 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.72.0 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.71.0 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.70.2 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.70.1 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.70.0 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.69.3 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.69.2 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.69.1 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.69.0 lib/avm/eac_webapp_base0/instance.rb