Method: Puppet::ModuleTool.build_tree

Defined in:
lib/puppet/module_tool.rb

.build_tree(mods, dir) ⇒ 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.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/puppet/module_tool.rb', line 93

def self.build_tree(mods, dir)
  mods.each do |mod|
    version_string = mod[:version].to_s.sub(/^(?!v)/, 'v')

    if mod[:action] == :upgrade
      previous_version = mod[:previous_version].to_s.sub(/^(?!v)/, 'v')
      version_string = "#{previous_version} -> #{version_string}"
    end

    mod[:text] = "#{mod[:name]} (#{colorize(:cyan, version_string)})"
    mod[:text] += " [#{mod[:path]}]" unless mod[:path].to_s == dir.to_s

    deps = mod[:dependencies] || []
    deps.sort_by! { |a| a[:name] }
    build_tree(deps, dir)
  end
end