Class: PDK::Generate::Fact

Inherits:
PuppetObject show all
Defined in:
lib/pdk/generate/fact.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/fact.rb', line 6

def friendly_name
  'Custom Fact'.freeze
end

#template_dataObject



21
22
23
# File 'lib/pdk/generate/fact.rb', line 21

def template_data
  { name: object_name }
end

#template_filesObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/pdk/generate/fact.rb', line 10

def template_files
  files = {
    'fact_spec.erb' => "#{File.join('spec', 'unit', 'facter', object_name)}_spec.rb"
  }
  return files if spec_only?

  files.merge(
    'fact.erb' => "#{File.join('lib', 'facter', object_name)}.rb"
  )
end