Class: Avm::Data::Package::Load
Instance Attribute Summary collapse
-
#data_file_path ⇒ Object
readonly
Returns the value of attribute data_file_path.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
Instance Method Summary collapse
- #cannot_run_reason ⇒ Object
- #data_file_exist? ⇒ Boolean
- #extract_packages_to_build_directory ⇒ Object
-
#initialize(package, data_file_path) ⇒ Load
constructor
A new instance of Load.
- #run ⇒ Object
- #runnable? ⇒ Boolean
Constructor Details
#initialize(package, data_file_path) ⇒ Load
Returns a new instance of Load.
14 15 16 17 |
# File 'lib/avm/data/package/load.rb', line 14 def initialize(package, data_file_path) @package = package @data_file_path = data_file_path end |
Instance Attribute Details
#data_file_path ⇒ Object (readonly)
Returns the value of attribute data_file_path.
12 13 14 |
# File 'lib/avm/data/package/load.rb', line 12 def data_file_path @data_file_path end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
12 13 14 |
# File 'lib/avm/data/package/load.rb', line 12 def package @package end |
Instance Method Details
#cannot_run_reason ⇒ Object
23 24 25 26 27 |
# File 'lib/avm/data/package/load.rb', line 23 def cannot_run_reason return nil if data_file_exist? "Data file \"#{data_file_path}\" does not exist" end |
#data_file_exist? ⇒ Boolean
36 37 38 |
# File 'lib/avm/data/package/load.rb', line 36 def data_file_exist? ::File.exist?(data_file_path) end |
#extract_packages_to_build_directory ⇒ Object
40 41 42 43 44 |
# File 'lib/avm/data/package/load.rb', line 40 def extract_packages_to_build_directory dir = ::Dir.mktmpdir ::Minitar.unpack(data_file_path, dir) dir end |
#run ⇒ Object
29 30 31 32 33 34 |
# File 'lib/avm/data/package/load.rb', line 29 def run raise "Cannot run: #{cannot_run_reason}" unless runnable? build_dir = extract_packages_to_build_directory package.load_units_from_directory(build_dir) end |
#runnable? ⇒ Boolean
19 20 21 |
# File 'lib/avm/data/package/load.rb', line 19 def runnable? cannot_run_reason.blank? end |