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

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/avm/stereotypes/eac_webapp_base0/deploy.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.



120
121
122
123
124
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy.rb', line 120

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.



118
119
120
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy.rb', line 118

def data_key
  @data_key
end

#fs_path_subpathObject (readonly)

Returns the value of attribute fs_path_subpath.



118
119
120
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy.rb', line 118

def fs_path_subpath
  @fs_path_subpath
end

Instance Method Details

#assert_source_directoryObject



131
132
133
134
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy.rb', line 131

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


144
145
146
147
148
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy.rb', line 144

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



126
127
128
129
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy.rb', line 126

def run
  assert_source_directory
  link_source_target
end

#source_pathObject



136
137
138
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy.rb', line 136

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

#target_pathObject



140
141
142
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy.rb', line 140

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