Class: PackerFiles::CentOS::Kickstart
- Inherits:
-
Object
- Object
- PackerFiles::CentOS::Kickstart
- Defined in:
- lib/PackerFiles/OS/CentOS/Kickstart.rb
Instance Method Summary collapse
-
#convert(obj, os_name) ⇒ Object
Serializes the given object and write out the content in the output file.
-
#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 @kickstart file.
-
#initialize(filename) ⇒ Kickstart
constructor
Constructor.
Constructor Details
#initialize(filename) ⇒ Kickstart
Constructor. The Kickstart file name is the name of the file that will be written to.
13 14 15 16 |
# File 'lib/PackerFiles/OS/CentOS/Kickstart.rb', line 13 def initialize(filename) @kickstart = 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/CentOS/Kickstart.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 @kickstart file
28 29 30 31 32 |
# File 'lib/PackerFiles/OS/CentOS/Kickstart.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 |