Class: Avm::Data::Instance::FilesUnit
- Inherits:
-
Unit
show all
- Defined in:
- lib/avm/data/instance/files_unit.rb
Constant Summary
collapse
- EXTENSION =
'.tar.gz'
Instance Attribute Summary collapse
Attributes inherited from Unit
#instance
Instance Method Summary
collapse
Methods inherited from Unit
#dump, #dump_to_directory, #extension, #load, #load_from_directory, #name
Constructor Details
#initialize(instance, fs_path_subpath) ⇒ FilesUnit
Returns a new instance of FilesUnit.
13
14
15
16
|
# File 'lib/avm/data/instance/files_unit.rb', line 13
def initialize(instance, fs_path_subpath)
super(instance)
@fs_path_subpath = fs_path_subpath
end
|
Instance Attribute Details
#fs_path_subpath ⇒ Object
Returns the value of attribute fs_path_subpath.
11
12
13
|
# File 'lib/avm/data/instance/files_unit.rb', line 11
def fs_path_subpath
@fs_path_subpath
end
|
Instance Method Details
#clear_files ⇒ Object
32
33
34
35
36
|
# File 'lib/avm/data/instance/files_unit.rb', line 32
def clear_files
infom "Removing all files under #{files_path}..."
instance.host_env.command('mkdir', '-p', files_path).execute!
instance.host_env.command('find', files_path, '-mindepth', 1, '-delete').execute!
end
|
#dump_command ⇒ Object
24
25
26
|
# File 'lib/avm/data/instance/files_unit.rb', line 24
def dump_command
instance.host_env.command('tar', '-czf', '-', '-C', files_path, '.')
end
|
#files_path ⇒ Object
20
21
22
|
# File 'lib/avm/data/instance/files_unit.rb', line 20
def files_path
::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH), fs_path_subpath)
end
|
#load_command ⇒ Object
28
29
30
|
# File 'lib/avm/data/instance/files_unit.rb', line 28
def load_command
instance.host_env.command('tar', '-xzf', '-', '-C', files_path)
end
|