Module: Puppet::Pops::Loader::LoaderPaths

Defined in:
lib/puppet/pops/loader/loader_paths.rb

Defined Under Namespace

Classes: DataTypePath, FunctionPath3x, FunctionPath4x, FunctionPathPP, PlanPath, PuppetSmartPath, ResourceTypeImplPP, RubySmartPath, SmartPath, SmartPaths, TaskPath, TypePathPP

Class Method Summary collapse

Class Method Details

.relative_paths_for_type(type, loader) ⇒ Object

Returns an array of SmartPath, each instantiated with a reference to the given loader (for root path resolution and existence checks). The smart paths in the array appear in precedence order. The returned array may be mutated.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/puppet/pops/loader/loader_paths.rb', line 17

def self.relative_paths_for_type(type, loader)
  result = []
  case type
  when :function
    # Only include support for the loadable items the loader states it can contain
    if loader.loadables.include?(:func_4x)
      result << FunctionPath4x.new(loader)
    end
    if loader.loadables.include?(:func_4xpp)
      result << FunctionPathPP.new(loader)
    end
    if loader.loadables.include?(:func_3x)
      result << FunctionPath3x.new(loader)
    end
  when :plan
    result << PlanPath.new(loader)
  when :task
    result << TaskPath.new(loader) if Puppet[:tasks] && loader.loadables.include?(:task)
  when :type
    result << DataTypePath.new(loader) if loader.loadables.include?(:datatype)
    result << TypePathPP.new(loader) if loader.loadables.include?(:type_pp)
  when :resource_type_pp
    result << ResourceTypeImplPP.new(loader) if loader.loadables.include?(:resource_type_pp)
  else
    # unknown types, simply produce an empty result; no paths to check, nothing to find... move along...
    []
  end
  result
end