class DTK::Client::Operation::Module::Install::DependentModules::ComponentDependencyTree::ResolveModules
Public Class Methods
new(parent, opts = {})
click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_dependency_tree/resolve_modules.rb, line 21 def initialize(parent, opts = {}) @print_helper = parent.print_helper @base_module_ref = parent.module_ref @cache = parent.cache @opts = opts end
resolve_conflicts(parent, opts = {})
click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_dependency_tree/resolve_modules.rb, line 29 def self.resolve_conflicts(parent, opts = {}) new(parent, opts).resolve_conflicts end
Public Instance Methods
resolve_conflicts()
click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_dependency_tree/resolve_modules.rb, line 32 def resolve_conflicts # TODO: change this simplistic method which does not take into accunt the nested structure. ret = [] @cache.all_modules_refs.each do |module_ref| # For legacy; removing self references if @base_module_ref.same_module?(module_ref) process_when_base_module(module_ref) else process_module_ref!(ret, module_ref) end end ret end
Private Instance Methods
process_module_ref!(ret, module_ref)
click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_dependency_tree/resolve_modules.rb, line 56 def process_module_ref!(ret, module_ref) matching_module_ref = ret.find { |selected_module_ref| module_ref.same_module?(selected_module_ref) } unless matching_module_ref ret << module_ref else unless module_ref.exact_match?(matching_module_ref) # TODO: DTK-2766: handle conflicts, initially by ignoring, but printing message about conflct and what is chosen # more advanced could replace what is in ret and choose modules_ref over it end end end
process_when_base_module(module_ref)
click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_dependency_tree/resolve_modules.rb, line 48 def process_when_base_module(module_ref) if @base_module_ref.exact_match?(module_ref) @print_helper.print_warning("Removing dependency '#{module_ref.pretty_print}' that referred to base module") unless @opts[:do_not_print] else @print_helper.print_warning("Removing conflicting dependency '#{module_ref.pretty_print}' that referred to base module '#{@base_module_ref.pretty_print}'") end end