class PuppetRakeTasks::DepChecker::Resolver
Class to detect all puppet module dependency issues. It uses puppet module tool internals to detect all issues.
Public Class Methods
# File lib/puppet_rake_tasks/depchecker/resolver.rb, line 21 def initialize(module_path = '.') @modulepath = Helpers.normalize_path(module_path) end
Public Instance Methods
Returns the puppet module tool environment. @see www.rubydoc.info/gems/puppet/Puppet/ModuleTool#environment_from_options-class_method
# File lib/puppet_rake_tasks/depchecker/resolver.rb, line 27 def env @env ||= Puppet::ModuleTool.environment_from_options(modulepath: modulepath_s) end
Returns the configured module paths. @return [Array<String>] configured module paths as an array.
# File lib/puppet_rake_tasks/depchecker/resolver.rb, line 46 def modulepath @modulepath ||= ['.'] end
Set the modulepath and normalize using {Helpers#normalize_path} When the module path changes, cached values are {#reset_caches cleared} @param [Array<String>,String] path Module paths @return [Array<String>] configured and normalized module paths.
# File lib/puppet_rake_tasks/depchecker/resolver.rb, line 60 def modulepath=(path) unless path == @modulepath # reset the env and loaded modules when changing the modulepath reset_caches end @modulepath = Helpers.normalize_path(path) end
Return modulepath as a string @return [String] module paths joined with `File::PATH_SEPARATOR`
# File lib/puppet_rake_tasks/depchecker/resolver.rb, line 52 def modulepath_s @modulepath.flatten.join(File::PATH_SEPARATOR) end
Collect the installed modules using Puppet::ModuleTool. @see www.rubydoc.info/gems/puppet/Puppet/ModuleTool/InstalledModules
# File lib/puppet_rake_tasks/depchecker/resolver.rb, line 33 def modules @modules ||= Puppet::ModuleTool::InstalledModules.new(env) end
Clear all cached data (env, modules, incidents)
# File lib/puppet_rake_tasks/depchecker/resolver.rb, line 38 def reset_caches @env = nil @modules = nil @incidents = nil end