From 162602323406117444ce4375ead91d8f92f2b31a Mon Sep 17 00:00:00 2001 From: luke Date: Wed, 7 Feb 2007 18:20:08 +0000 Subject: Adding a libdir setting for puppet, so you can store your modifications to puppet in a separate directory. This probably will still be somewhat limited because it will always depend somewhat on load order. For instance, if you add a new provider, it might not be available when you expect, since providers are all loaded as soon as a type is loaded, which might happen before the libdir is set. It should always work fine if you do not override it, but if you do override it, things might behave a bit strange. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2174 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/autoload.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/puppet/autoload.rb') diff --git a/lib/puppet/autoload.rb b/lib/puppet/autoload.rb index c32863fe2..862aabbff 100644 --- a/lib/puppet/autoload.rb +++ b/lib/puppet/autoload.rb @@ -18,6 +18,12 @@ class Puppet::Autoload Puppet::Util.proxy self, :loaded, :clear + def handle_libdir + dir = Puppet[:libdir] + + $: << dir unless $:.include?(dir) + end + def initialize(obj, path, options = {}) @path = path.to_s @object = obj @@ -42,6 +48,7 @@ class Puppet::Autoload def load(name) name = symbolize(name) + handle_libdir() path = File.join(@path, name.to_s + ".rb") @@ -68,6 +75,7 @@ class Puppet::Autoload end def loadall + handle_libdir() # Load every instance of everything we can find. $:.each do |dir| fdir = File.join(dir, @path) -- cgit