diff options
author | Luke Kanies <luke@madstop.com> | 2007-11-23 18:27:20 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-11-23 18:27:20 -0600 |
commit | 0e1b6e8ac6f95bd7fc161a1d4da3a9295ff5c65b (patch) | |
tree | addc3b7deb9a69c5786c16fb761212e266a3613f /lib/puppet/module.rb | |
parent | 56aad69f8cdf8b0b08fdb7985014986223fa4455 (diff) | |
parent | 44410525722d4de0ed416f42c7d094d42f6602a6 (diff) | |
download | puppet-0e1b6e8ac6f95bd7fc161a1d4da3a9295ff5c65b.tar.gz puppet-0e1b6e8ac6f95bd7fc161a1d4da3a9295ff5c65b.tar.xz puppet-0e1b6e8ac6f95bd7fc161a1d4da3a9295ff5c65b.zip |
Merge commit 'davids-bugfixes/rest/fix-891' into plugins_mount
Diffstat (limited to 'lib/puppet/module.rb')
-rw-r--r-- | lib/puppet/module.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb index 45860c74d..3ff4fa470 100644 --- a/lib/puppet/module.rb +++ b/lib/puppet/module.rb @@ -4,7 +4,7 @@ class Puppet::Module TEMPLATES = "templates" FILES = "files" MANIFESTS = "manifests" - + # Return an array of paths by splitting the +modulepath+ config # parameter. Only consider paths that are absolute and existing # directories @@ -27,14 +27,27 @@ class Puppet::Module return nil end - modpath = modulepath(environment).collect { |path| - File::join(path, modname) - }.find { |f| File::directory?(f) } + modpath = all(environment).find { |f| File::directory?(f) } return nil unless modpath return self.new(modname, modpath) end + # Return an array of the full path of every subdirectory in each + # directory in the modulepath. + def self.all(environment = nil) + modulepath(environment).map do |mp| + Dir.new(mp).map do |modfile| + modpath = File.join(mp, modfile) + unless modfile == '.' or modfile == '..' or !File.directory?(modpath) + modpath + else + nil + end + end + end.flatten.compact + end + # Instance methods # Find the concrete file denoted by +file+. If +file+ is absolute, |