Module: Puppet::Pops::Loader::ModuleLoaders Private
- Defined in:
- lib/puppet/pops/loader/module_loaders.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
ModuleLoaders
A ModuleLoader loads items from a single module. The ModuleLoaders (ruby) module contains various such loaders. There is currently one concrete implementation, ModuleLoaders::FileBased that loads content from the file system. Other implementations can be created - if they are based on name to path mapping where the path is relative to a root path, they can derive the base behavior from the ModuleLoaders::AbstractPathBasedModuleLoader class.
Examples of such extensions could be a zip/jar/compressed file base loader.
Notably, a ModuleLoader does not configure itself - it is given the information it needs (the root, its name etc.) Logic higher up in the loader hierarchy of things makes decisions based on the “shape of modules”, and “available modules” to determine which module loader to use for each individual module. (There could be differences in internal layout etc.)
A module loader is also not aware of the mapping of name to relative paths - this is performed by the included module Puppet::Pops::Loader::PathBasedInstantatorConfig which knows about the map from type/name to relative path, and the logic that can instantiate what is expected to be found in the content of that path.
Defined Under Namespace
Classes: AbstractPathBasedModuleLoader, FileBased, GemBased
Class Method Summary collapse
- .module_loader_from(parent_loader, loaders, module_name, module_path) ⇒ Object private
- .system_loader_from(parent_loader, loaders) ⇒ Object private
Class Method Details
.module_loader_from(parent_loader, loaders, module_name, module_path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 41 42 43 |
# File 'lib/puppet/pops/loader/module_loaders.rb', line 37 def self.module_loader_from(parent_loader, loaders, module_name, module_path) Puppet::Pops::Loader::ModuleLoaders::FileBased.new(parent_loader, loaders, module_name, File.join(module_path, 'lib'), module_name) end |
.system_loader_from(parent_loader, loaders) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/puppet/pops/loader/module_loaders.rb', line 23 def self.system_loader_from(parent_loader, loaders) # Puppet system may be installed in a fixed location via RPM, installed as a Gem, via source etc. # The only way to find this across the different ways puppet can be installed is # to search up the path from this source file's __FILE__ location until it finds the base of # puppet. # puppet_lib = File.join(File.dirname(__FILE__), '../../..') Puppet::Pops::Loader::ModuleLoaders::FileBased.new(parent_loader, loaders, nil, puppet_lib, 'puppet_system') end |