Sha256: 13fd862c230f5045cff928ce9660829d5bada30c19e6d89f86b9d64e5a40f07a

Contents?: true

Size: 1.88 KB

Versions: 11

Compression:

Stored size: 1.88 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
    module 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

11 entries across 11 versions & 1 rubygems

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