summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/autoload.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-13 16:52:26 -0600
committerLuke Kanies <luke@madstop.com>2008-02-13 16:52:26 -0600
commitf8afe131699f1f0afe834b070af285fd56f6320d (patch)
tree7f3c5db91aeefaaaf4ffeb3efdaa80f6efe995fb /lib/puppet/util/autoload.rb
parentfe02591eaad7c8648699b53c9361ffab851e2022 (diff)
downloadpuppet-f8afe131699f1f0afe834b070af285fd56f6320d.tar.gz
puppet-f8afe131699f1f0afe834b070af285fd56f6320d.tar.xz
puppet-f8afe131699f1f0afe834b070af285fd56f6320d.zip
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.
Diffstat (limited to 'lib/puppet/util/autoload.rb')
-rw-r--r--lib/puppet/util/autoload.rb11
1 files changed, 8 insertions, 3 deletions
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