Class: Avm::Stereotypes::EacWebappBase0::Deploy::FilesUnit

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deploy, data_key, fs_path_subpath) ⇒ FilesUnit

Returns a new instance of FilesUnit.



10
11
12
13
14
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb', line 10

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.



8
9
10
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb', line 8

def data_key
  @data_key
end

#fs_path_subpathObject (readonly)

Returns the value of attribute fs_path_subpath.



8
9
10
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb', line 8

def fs_path_subpath
  @fs_path_subpath
end

Instance Method Details

#assert_source_directoryObject



21
22
23
24
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb', line 21

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


34
35
36
37
38
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb', line 34

def link_source_target
  infom "Linking \"#{data_key}\" directory..."
  instance.host_env.command('rm', '-rf', target_path).execute!
  instance.host_env.command('ln', '-s', source_path, target_path).execute!
end

#runObject



16
17
18
19
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb', line 16

def run
  assert_source_directory
  link_source_target
end

#source_pathObject



26
27
28
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb', line 26

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

#target_pathObject



30
31
32
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb', line 30

def target_path
  ::File.join(instance.read_entry(:fs_path), fs_path_subpath.to_s)
end