Sha256: 1097fb12e030fe38d2acd987f11aff1c918bd7af3956aa625aac4dec954a5ef2

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 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
        class Load
          runner_with :help do
            desc 'Load utility for EacRailsBase instance.'
            arg_opt '-S', '--source-instance', 'Informa a instância a ser extraída o dump.'
            pos_arg :dump_path, optional: true
          end

          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 parsed.dump_path.to_s if parsed.dump_path.present?
            return source_instance_dump_path if parsed.source_instance.present?

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

          def source_instance_dump_path
            runner_context.call(:instance).class.by_id(parsed.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
            runner_context.call(:instance).data_package.load(dump_path)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
avm-tools-0.98.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.97.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.96.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.95.0 lib/avm/eac_webapp_base0/runner/data/load.rb
avm-tools-0.94.3 lib/avm/eac_webapp_base0/runner/data/load.rb