Method: PDK::Generate::PuppetObject#stage_change

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

#stage_change(relative_dest_path, content, update_manager) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Stages a single file into the Update Manager.



122
123
124
125
126
127
128
129
130
131
# File 'lib/pdk/generate/puppet_object.rb', line 122

def stage_change(relative_dest_path, content, update_manager)
  absolute_file_path = File.join(context.root_path, relative_dest_path)
  if PDK::Util::Filesystem.exist?(absolute_file_path)
    raise PDK::CLI::ExitWithError, _("Unable to generate %{object_type}; '%{file}' already exists.") % {
      file:        absolute_file_path,
      object_type: spec_only? ? 'unit test' : friendly_name,
    }
  end
  update_manager.add_file(absolute_file_path, content)
end