lib/pdk/generators/puppet_object.rb
# Render a file using the provided template and write it to disk.
#
# @param dest_path [String] The path that the rendered file should be
#   written to. Any necessary directories will be automatically created.
# @param template_path [String] The path on disk to the file containing
#   the template.
# @param data [Hash{Object => Object}] The data to be provided to the
#   template when rendering.
#
# @return [void]
#
# @api private
Render a file using the provided template and write it to disk.
Render a file using the provided template and write it to disk .
def render_file(dest_path, template_path, data)
        PDK.logger.info(_("Creating '%{file}' from template.") % { file: dest_path })
        file_content = PDK::TemplateFile.new(template_path, data).render
        FileUtils.mkdir_p(File.dirname(dest_path))
        File.open(dest_path, 'w') { |f| f.write file_content }
      end
def render_file ( dest_path , template_path , data ) PDK . logger . info ( _ ( "Creating '%{file}' from template." ) % { file : dest_path } ) file_content = PDK :: TemplateFile . new ( template_path , data ) . render FileUtils . mkdir_p ( File . dirname ( dest_path ) ) File . open ( dest_path , 'w' ) { | f | f . write file_content } end
Render a file using the provided template and write it to disk.
Render a file using the provided template and write it to disk .
None
void
dest_path
The path that the rendered file should be written to. Any necessary directories will be automatically created.
The path that the rendered file should be written to . Any necessary directories will be automatically created .
template_path
The path on disk to the file containing the template.
The path on disk to the file containing the template .
data
The data to be provided to the template when rendering.
The data to be provided to the template when rendering .
api
None