Class: Avm::EacWebappBase0::Instances::Deploy::SetupFilesUnit

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deploy, data_key, fs_path_subpath) ⇒ SetupFilesUnit

Returns a new instance of SetupFilesUnit.



11
12
13
14
15
# File 'lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb', line 11

def initialize(deploy, data_key, fs_path_subpath)
  super(deploy)
  @data_key = data_key
  @fs_path_subpath = fs_path_subpath
end

Instance Attribute Details

#data_keyObject (readonly)

Returns the value of attribute data_key.



9
10
11
# File 'lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb', line 9

def data_key
  @data_key
end

#fs_path_subpathObject (readonly)

Returns the value of attribute fs_path_subpath.



9
10
11
# File 'lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb', line 9

def fs_path_subpath
  @fs_path_subpath
end

Instance Method Details

#assert_source_directoryObject



22
23
24
25
# File 'lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb', line 22

def assert_source_directory
  infom "Asserting \"#{data_key}\" source directory..."
  instance.host_env.command('mkdir', '-p', source_path).execute!
end


36
37
38
39
40
41
# File 'lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb', line 36

def link_source_target
  infom "Linking \"#{data_key}\" directory..."
  return unless remove_target

  instance.host_env.command('ln', '-s', source_path, target_path).execute!
end

#resultObject



17
18
19
20
# File 'lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb', line 17

def result
  assert_source_directory
  link_source_target
end

#source_pathObject



27
28
29
# File 'lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb', line 27

def source_path
  ::File.join(instance.install_data_path, data_key.to_s)
end

#target_pathObject



31
32
33
34
# File 'lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb', line 31

def target_path
  ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH),
              fs_path_subpath.to_s)
end