Sha256: b880d6be38800b4d6eb205abeffa1120ae138fa32e27904f9181d46223b2b51b

Contents?: true

Size: 1.43 KB

Versions: 18

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true

require 'avm/data/dumper'
require 'eac_cli/core_ext'
require 'avm/tools/runner_with/instance_data_performer'

module Avm
  module Tools
    module RunnerWith
      module InstanceDataDump
        common_concern do
          enable_simple_cache
          runner_definition do
            bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
            pos_arg :dump_path, optional: true
          end

          set_callback :run, :after do
            success("Dump path: \"#{dump_path}\"")
            dump_path
          end
        end

        include ::Avm::Tools::RunnerWith::InstanceDataPerformer

        DUMP_EXPIRE_TIME = 1.day
        NO_DUMP_MESSAGE = 'Dump "%s" already exist and rewrite options was no setted nor ' \
          'dump was expired.'

        # @return [Class]
        def data_performer_class
          ::Avm::Data::Dumper
        end

        # @return [String]
        def help_extra_text
          "Default dump path: \"#{default_dump_path}\""
        end

        private

        # @return [Avm::Data::Dumper]
        def data_performer_uncached
          r = super.overwrite(parsed.rewrite?)
          parsed.dump_path.if_present(r) { |v| r.target_path(v.to_pathname) }
        end

        # @return [Pathname]
        def dump_path
          data_performer.target_path
        end

        def default_dump_path
          data_performer.default_dump_path
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
eac_tools-0.76.1 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.76.0 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.75.2 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.75.1 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.75.0 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.74.1 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
avm-tools-0.154.0 lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.74.0 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
avm-tools-0.153.0 lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.73.0 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
avm-tools-0.152.0 lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.72.0 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.70.1 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.70.0 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
avm-tools-0.151.1 lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.69.1 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
avm-tools-0.151.0 lib/avm/tools/runner_with/instance_data_dump.rb
eac_tools-0.69.0 sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb