Sha256: e10e2532f049757211f9512f90bfdfdced405effb2da4f8b5526ec995479a926

Contents?: true

Size: 1.99 KB

Versions: 51

Compression:

Stored size: 1.99 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 Stereotypes
    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
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
avm-tools-0.68.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.67.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.66.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.65.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.64.2 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.64.1 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.64.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.63.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.62.4 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.62.3 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.62.2 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.62.1 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.62.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.61.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.60.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.59.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.58.1 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.58.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.57.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
avm-tools-0.56.0 lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb