Module: Avm::Files::Appendable

Included in:
Appender, Deploy
Defined in:
lib/avm/files/appendable.rb,
lib/avm/files/appendable/file_content.rb,
lib/avm/files/appendable/resource_base.rb,
lib/avm/files/appendable/plain_directory.rb,
lib/avm/files/appendable/tar_output_command.rb,
lib/avm/files/appendable/templatized_directory.rb

Defined Under Namespace

Classes: FileContent, PlainDirectory, ResourceBase, TarOutputCommand, TemplatizedDirectory

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#variables_sourceObject (readonly)

Returns the value of attribute variables_source.



10
11
12
# File 'lib/avm/files/appendable.rb', line 10

def variables_source
  @variables_source
end

Instance Method Details

#append_file_content(target_path, content) ⇒ Object



36
37
38
39
40
# File 'lib/avm/files/appendable.rb', line 36

def append_file_content(target_path, content)
  appended << ::Avm::Files::Appendable::FileContent
              .new(self, target_path, content)
  self
end

#append_plain_directory(directory) ⇒ Object



21
22
23
24
# File 'lib/avm/files/appendable.rb', line 21

def append_plain_directory(directory)
  appended << ::Avm::Files::Appendable::PlainDirectory.new(self, directory)
  self
end

#append_tar_output_command(tar_command) ⇒ Object



26
27
28
29
# File 'lib/avm/files/appendable.rb', line 26

def append_tar_output_command(tar_command)
  appended << ::Avm::Files::Appendable::TarOutputCommand.new(self, tar_command)
  self
end

#append_templatized_directories(directories) ⇒ Object



16
17
18
19
# File 'lib/avm/files/appendable.rb', line 16

def append_templatized_directories(directories)
  directories.each { |directory| append_templatized_directory(directory) }
  self
end

#append_templatized_directory(directory) ⇒ Object



31
32
33
34
# File 'lib/avm/files/appendable.rb', line 31

def append_templatized_directory(directory)
  appended << ::Avm::Files::Appendable::TemplatizedDirectory.new(self, directory)
  self
end

#appendedObject



12
13
14
# File 'lib/avm/files/appendable.rb', line 12

def appended
  @appended ||= []
end

#variables_source_set(source) ⇒ Object



42
43
44
45
# File 'lib/avm/files/appendable.rb', line 42

def variables_source_set(source)
  @variables_source = source
  self
end

#write_appended_on(target_dir) ⇒ Object



47
48
49
50
51
52
# File 'lib/avm/files/appendable.rb', line 47

def write_appended_on(target_dir)
  target_dir = target_dir.to_pathname
  raise "\"#{target_dir}\" is not a directory" unless target_dir.directory?

  appended.each { |append| append.write_on(target_dir) }
end