Sha256: 501dabd88078b130c6e9e03a2a6915b78866fdacbd396024f69644eddc17f39a

Contents?: true

Size: 1 KB

Versions: 25

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'avm/data/package/build_directory'
require 'eac_ruby_utils/core_ext'
require 'minitar'

module Avm
  module Data
    class Package
      class Load
        enable_speaker
        include ::Avm::Data::Package::BuildDirectory

        common_constructor :package, :data_file_path

        def runnable?
          cannot_run_reason.blank?
        end

        def cannot_run_reason
          return nil if data_file_exist?

          "Data file \"#{data_file_path}\" does not exist"
        end

        def run
          raise "Cannot run: #{cannot_run_reason}" unless runnable?

          on_build_directory do
            extract_packages_to_build_directory
            package.load_units_from_directory(build_directory)
          end
        end

        def data_file_exist?
          ::File.exist?(data_file_path)
        end

        def extract_packages_to_build_directory
          ::Minitar.unpack(data_file_path, build_directory.to_path)
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
avm-0.74.0 lib/avm/data/package/load.rb
eac_tools-0.68.0 sub/avm/lib/avm/data/package/load.rb
avm-0.73.1 lib/avm/data/package/load.rb
eac_tools-0.67.1 sub/avm/lib/avm/data/package/load.rb
avm-0.73.0 lib/avm/data/package/load.rb
eac_tools-0.67.0 sub/avm/lib/avm/data/package/load.rb
avm-0.72.0 lib/avm/data/package/load.rb
eac_tools-0.66.0 sub/avm/lib/avm/data/package/load.rb
eac_tools-0.65.1 sub/avm/lib/avm/data/package/load.rb
avm-0.71.0 lib/avm/data/package/load.rb
eac_tools-0.65.0 sub/avm/lib/avm/data/package/load.rb
avm-0.70.0 lib/avm/data/package/load.rb
eac_tools-0.64.0 sub/avm/lib/avm/data/package/load.rb
avm-0.69.0 lib/avm/data/package/load.rb
eac_tools-0.63.0 sub/avm/lib/avm/data/package/load.rb
eac_tools-0.62.1 sub/avm/lib/avm/data/package/load.rb
avm-0.68.0 lib/avm/data/package/load.rb
eac_tools-0.62.0 sub/avm/lib/avm/data/package/load.rb
eac_tools-0.61.1 sub/avm/lib/avm/data/package/load.rb
eac_tools-0.61.0 sub/avm/lib/avm/data/package/load.rb