Class: PDK::Generate::Provider

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

def friendly_name
  'Resource API Provider'.freeze
end

#template_dataObject



23
24
25
26
# File 'lib/pdk/generate/provider.rb', line 23

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

#template_filesObject



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

def template_files
  files = {
    'provider_spec.erb' => "#{File.join('spec', 'unit', 'puppet', 'provider', object_name, object_name)}_spec.rb",
    'provider_type_spec.erb' => "#{File.join('spec', 'unit', 'puppet', 'type', object_name)}_spec.rb"
  }
  return files if spec_only?

  files.merge(
    'provider.erb' => "#{File.join('lib', 'puppet', 'provider', object_name, object_name)}.rb",
    'provider_type.erb' => "#{File.join('lib', 'puppet', 'type', object_name)}.rb"
  )
end