Method: Puppet::ModuleTool.find_module_root

Defined in:
lib/puppet/module_tool.rb

.find_module_root(path) ⇒ Pathname?

Find the module root when given a path by checking each directory up from its current location until it finds one that satisfies is_module_root?

Parameters:

  • path (Pathname, String)

    path to start from

Returns:

  • (Pathname, nil)

    the root path of the module directory or nil if we cannot find one



48
49
50
51
52
53
54
55
56
# File 'lib/puppet/module_tool.rb', line 48

def self.find_module_root(path)
  path = Pathname.new(path) if path.class == String

  path.expand_path.ascend do |p|
    return p if is_module_root?(p)
  end

  nil
end