Method: PDK::Generate::PuppetObject#run

Defined in:
lib/pdk/generate/puppet_object.rb

#runObject

Check that the templates can be rendered. Find an appropriate template and create the target files from the template. This is the main entry point for the class.

Raises:



127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/pdk/generate/puppet_object.rb', line 127

def run
  check_preconditions

  with_templates do |template_path, config_hash|
    data = template_data.merge(configs: config_hash)

    render_file(target_object_path, template_path[:object], data)
    render_file(target_type_path, template_path[:type], data) if template_path[:type]
    render_file(target_device_path, template_path[:device], data) if template_path[:device]
    render_file(target_spec_path, template_path[:spec], data) if template_path[:spec]
    render_file(target_type_spec_path, template_path[:type_spec], data) if template_path[:type_spec]
  end
end