From f8afe131699f1f0afe834b070af285fd56f6320d Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Wed, 13 Feb 2008 16:52:26 -0600 Subject: Fixed #1043 -- autoloading now searches the plugins directory in each module, in addition to the lib directory. The 'lib' directory is also deprecated, but supported for now to give people a chance to convert. --- lib/puppet/util/autoload.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index a52575522..4b77fa3eb 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -1,6 +1,9 @@ +require 'puppet/util/warnings' + # Autoload paths, either based on names or all at once. class Puppet::Util::Autoload include Puppet::Util + include Puppet::Util::Warnings @autoloaders = {} @loaded = [] @@ -123,8 +126,6 @@ class Puppet::Util::Autoload end end - private - # Yield each subdir in turn. def eachdir searchpath.each do |dir| @@ -137,7 +138,11 @@ class Puppet::Util::Autoload def searchpath # JJM: Search for optional lib directories in each module bundle. module_lib_dirs = Puppet[:modulepath].split(":").collect do |d| - Dir.glob("%s/*/lib" % d).select do |f| + Dir.glob("%s/*/{plugins,lib}" % d).select do |f| + if f =~ /lib$/ + # LAK: Deprecated on 2/14/08 + warnonce "Using 'lib' in modules is deprecated; switch %s to 'plugins'" % f + end FileTest.directory?(f) end end.flatten -- cgit