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 From 482971103b436e030606371df69bf4dfbbf54a2c Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Wed, 13 Feb 2008 17:18:23 -0600 Subject: removing "lib" deprecation notice from autoloader --- lib/puppet/util/autoload.rb | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index 4b77fa3eb..5f13d936b 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -139,10 +139,6 @@ class Puppet::Util::Autoload # JJM: Search for optional lib directories in each module bundle. module_lib_dirs = Puppet[:modulepath].split(":").collect do |d| 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 From 892055709a7e0b628758d24aba7590fd3c78426b Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Wed, 13 Feb 2008 17:29:23 -0600 Subject: Fixing #1064 -- providers et al are now autoloaded from modules even when Autoload#loadall is used. --- lib/puppet/util/autoload.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index 5f13d936b..535d9ef2e 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -112,9 +112,8 @@ class Puppet::Util::Autoload Dir.glob("#{dir}/*.rb").each do |file| name = File.basename(file).sub(".rb", '').intern next if loaded?(name) - rubypath = File.join(@path, name.to_s) begin - Kernel.require rubypath + Kernel.require file loaded(name, file) rescue => detail if Puppet[:trace] -- cgit