Sha256: e454872fa797550db96feeafa112b609db563d578f36d2ab211ae9bb53d5ab7f

Contents?: true

Size: 1.31 KB

Versions: 8

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require 'avm/instances/base'
require 'avm/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::Postgresql::InstanceWith

      FILES_UNITS = [].freeze

      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

8 entries across 8 versions & 1 rubygems

Version Path
avm-tools-0.94.2 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.94.1 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.94.0 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.93.0 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.92.0 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.91.0 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.90.0 lib/avm/eac_webapp_base0/instance.rb
avm-tools-0.89.0 lib/avm/eac_webapp_base0/instance.rb