Sha256: 545a0276eeaf43104c896b12f34e4339036d4de1f0cd1fca5348efc23b81d5f3

Contents?: true

Size: 1.9 KB

Versions: 24

Compression:

Stored size: 1.9 KB

Contents

# frozen_string_literal: true

require 'active_support/core_ext/numeric/time'
require 'eac_ruby_utils/console/speaker'
require 'eac_ruby_utils/simple_cache'

module Avm
  module EacWebappBase0
    class Runner < ::Avm::Instances::Runner
      class Data < ::EacRubyUtils::Console::DocoptRunner
        class Load < ::EacRubyUtils::Console::DocoptRunner
          include ::EacRubyUtils::SimpleCache
          include ::EacRubyUtils::Console::Speaker

          DOC = <<~DOCUMENT
            Load utility for EacRailsBase instance.

            Usage:
              __PROGRAM__ (<dump-path>|--source-instance=<source-instance>)
              __PROGRAM__ -h | --help

            Options:
              -h --help                               Show this screen.
              -S --source-instance=<source-instance>  Informa a instância a ser extraída o dump.
          DOCUMENT

          def run
            return ::Dev::Result.error("Dump \"#{dump_path}\" does not exist") unless
            ::File.exist?(dump_path)

            load_dump
            success("Dump loaded from \"#{dump_path}\"")
          end

          def dump_path_uncached
            return options.fetch('<dump-path>').to_s if options.fetch('<dump-path>').present?
            return source_instance_dump_path if options.fetch('--source-instance').present?

            raise "Dump path unknown (Options: #{options})"
          end

          def source_instance_dump_path
            context(:instance).class.by_id(
              options.fetch('--source-instance')
            ).data_dump
          end

          def load_dump
            info "Loading dump \"#{dump_path}\"..."
            package_load.run
          end

          def dump_instance_method
            :dump_database
          end

          private

          def package_load_uncached
            context(:instance).data_package.load(dump_path)
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
avm-tools-0.92.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.91.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.90.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.89.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.88.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.87.1 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.87.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.86.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.85.1 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.85.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.84.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.83.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.82.1 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.82.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.81.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.80.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.79.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.78.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.77.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.76.1 lib/avm/eac_webapp_base0/runner/data/load.rb