Class: Avm::Data::Package::Load

Inherits:
Object
  • Object
show all
Includes:
BuildDirectory
Defined in:
lib/avm/data/package/load.rb

Instance Method Summary collapse

Instance Method Details

#cannot_run_reasonObject



20
21
22
23
24
# File 'lib/avm/data/package/load.rb', line 20

def cannot_run_reason
  return nil if data_file_exist?

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

#data_file_exist?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/avm/data/package/load.rb', line 35

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

#extract_packages_to_build_directoryObject



39
40
41
# File 'lib/avm/data/package/load.rb', line 39

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

#runObject



26
27
28
29
30
31
32
33
# File 'lib/avm/data/package/load.rb', line 26

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

#runnable?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/avm/data/package/load.rb', line 16

def runnable?
  cannot_run_reason.blank?
end