Class: PackerFiles::Debian::Preseed

Inherits:
Object
  • Object
show all
Defined in:
lib/PackerFiles/OS/Debian/Preseed.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Preseed

Constructor. The preseed file name is the name of the file that will be written to.



13
14
15
16
# File 'lib/PackerFiles/OS/Debian/Preseed.rb', line 13

def initialize(filename)
   @preseed = filename
	create_file
end

Instance Method Details

#convert(obj, os_name) ⇒ Object

Serializes the given object and write out the content in the output file.



20
21
22
23
24
# File 'lib/PackerFiles/OS/Debian/Preseed.rb', line 20

def convert(obj, os_name)
   file     = erb_file(obj, os_name)
	content  = PackerFiles.evaluate_erb(file, { "obj" => obj })
	add_content(content)
end

#eval_file(file_name, hash) ⇒ Object

Evaluate a partially specified file name (should be in the Gem’s file list though) and add the content to the @preseed file



28
29
30
31
32
# File 'lib/PackerFiles/OS/Debian/Preseed.rb', line 28

def eval_file(file_name, hash)
  erb_file = PackerFiles.DirPath(file_name).first
  content  = PackerFiles.evaluate_erb(erb_file, hash)
  add_content(content)
end