Class: PDK::Generate::Transport

Inherits:
PuppetObject show all
Defined in:
lib/pdk/generate/transport.rb

Instance Attribute Summary

Attributes inherited from PuppetObject

#context, #object_name, #options

Instance Method Summary collapse

Methods inherited from PuppetObject

#can_run?, #check_preconditions, #initialize, #module_name, #non_template_files, #run, #spec_only?, #stage_change, #stage_changes, #templates, #update_manager_instance, #with_templates

Constructor Details

This class inherits a constructor from PDK::Generate::PuppetObject

Instance Method Details

#friendly_nameObject



6
7
8
# File 'lib/pdk/generate/transport.rb', line 6

def friendly_name
  'Resource API Transport'.freeze
end

#template_dataObject



26
27
28
29
30
31
# File 'lib/pdk/generate/transport.rb', line 26

def template_data
  {
    name: object_name,
    transport_class: class_name_from_object_name(object_name)
  }
end

#template_filesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pdk/generate/transport.rb', line 10

def template_files
  # NOTE: Due to how the V1 templates work, the names of the source template files may be mismatched to
  # their destination, e.g. transport_type.erb is really a transport schema
  files = {
    'transport_spec.erb' => "#{File.join('spec', 'unit', 'puppet', 'transport', object_name)}_spec.rb",
    'transport_type_spec.erb' => "#{File.join('spec', 'unit', 'puppet', 'transport', 'schema', object_name)}_spec.rb"
  }
  return files if spec_only?

  files.merge(
    'transport.erb' => "#{File.join('lib', 'puppet', 'transport', object_name)}.rb",
    'transport_device.erb' => File.join('lib', 'puppet', 'util', 'network_device', object_name, 'device.rb'),
    'transport_type.erb' => "#{File.join('lib', 'puppet', 'transport', 'schema', object_name)}.rb"
  )
end