summaryrefslogtreecommitdiffstats
path: root/lib/puppet/autoload.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-07 18:20:08 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-07 18:20:08 +0000
commit162602323406117444ce4375ead91d8f92f2b31a (patch)
tree7aa885b5fb2767ad731a32d023e804de5d6876b5 /lib/puppet/autoload.rb
parent99c8a548c7980408cde0ffc51a3b7685a4965978 (diff)
downloadpuppet-162602323406117444ce4375ead91d8f92f2b31a.tar.gz
puppet-162602323406117444ce4375ead91d8f92f2b31a.tar.xz
puppet-162602323406117444ce4375ead91d8f92f2b31a.zip
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
Diffstat (limited to 'lib/puppet/autoload.rb')
-rw-r--r--lib/puppet/autoload.rb8
1 files changed, 8 insertions, 0 deletions
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)