Sha256: 46d19700c86ffaa7b91aa51d07bc6456c42fee6431f74578f1235677e572934e

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

require 'pdk'

module PDK
  module Generate
    class Transport < ResourceAPIObject
      def friendly_name
        'Resource API Transport'.freeze
      end

      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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pdk-1.18.1 lib/pdk/generate/transport.rb
pdk-1.18.0 lib/pdk/generate/transport.rb