Class: PuppetRakeTasks::DepChecker::Resolver
- Inherits:
-
Object
- Object
- PuppetRakeTasks::DepChecker::Resolver
- Defined in:
- lib/puppet_rake_tasks/depchecker/resolver.rb,
lib/puppet_rake_tasks/depchecker/filter.rb,
lib/puppet_rake_tasks/depchecker/report.rb,
lib/puppet_rake_tasks/depchecker/ignores.rb,
lib/puppet_rake_tasks/depchecker/incidents.rb
Overview
Class to detect all puppet module dependency issues. It uses puppet module tool internals to detect all issues.
Defined Under Namespace
Modules: Filter, Ignores, Incidents, Report
Instance Attribute Summary
Attributes included from Report
#fail_on_error, #format, #output
Instance Method Summary collapse
-
#env ⇒ Object
Returns the puppet module tool environment.
-
#initialize(module_path = '.') ⇒ Resolver
constructor
A new instance of Resolver.
-
#modulepath ⇒ Array<String>
Returns the configured module paths.
-
#modulepath=(path) ⇒ Array<String>
Set the modulepath and normalize using Helpers.normalize_path When the module path changes, cached values are cleared.
-
#modulepath_s ⇒ String
Return modulepath as a string.
-
#modules ⇒ Object
Collect the installed modules using Puppet::ModuleTool.
-
#reset_caches ⇒ Object
Clear all cached data (env, modules, incidents).
Methods included from Report
#enrich_incident, #format_incident, #format_module_incidents, #report
Methods included from Helpers
compare_values, normalize_path, swat_hash
Methods included from Filter
#filter_incidents, #filter_module_incidents, #filtered
Methods included from Incidents
#incidents, #initialize_incidents
Methods included from Ignores
#collect_ignores_for_module, #ignore, #ignores, #ignores=, #ignores_for_module, #ignores_matches_incident
Constructor Details
#initialize(module_path = '.') ⇒ Resolver
Returns a new instance of Resolver.
21 22 23 |
# File 'lib/puppet_rake_tasks/depchecker/resolver.rb', line 21 def initialize(module_path = '.') @modulepath = Helpers.normalize_path(module_path) end |
Instance Method Details
#env ⇒ Object
Returns the puppet module tool environment.
27 28 29 |
# File 'lib/puppet_rake_tasks/depchecker/resolver.rb', line 27 def env @env ||= Puppet::ModuleTool.(modulepath: modulepath_s) end |
#modulepath ⇒ Array<String>
Returns the configured module paths.
46 47 48 |
# File 'lib/puppet_rake_tasks/depchecker/resolver.rb', line 46 def modulepath @modulepath ||= ['.'] end |
#modulepath=(path) ⇒ Array<String>
Set the modulepath and normalize using Helpers.normalize_path When the module path changes, cached values are cleared
60 61 62 63 64 65 66 |
# 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 |
#modulepath_s ⇒ String
Return modulepath as a string
52 53 54 |
# File 'lib/puppet_rake_tasks/depchecker/resolver.rb', line 52 def modulepath_s @modulepath.flatten.join(File::PATH_SEPARATOR) end |
#modules ⇒ Object
Collect the installed modules using Puppet::ModuleTool.
33 34 35 |
# File 'lib/puppet_rake_tasks/depchecker/resolver.rb', line 33 def modules @modules ||= Puppet::ModuleTool::InstalledModules.new(env) end |
#reset_caches ⇒ Object
Clear all cached data (env, modules, incidents)
38 39 40 41 42 |
# File 'lib/puppet_rake_tasks/depchecker/resolver.rb', line 38 def reset_caches @env = nil @modules = nil @incidents = nil end |