Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index 69a80fa..89b241a 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -63,11 +63,15 @@ class Puppet::Util::Autoload unless defined? @wrap @wrap = true end + + @could_not_find = {} end # Load a single plugin by name. We use 'load' here so we can reload a # given plugin. def load(name) + return false if already_missed?(name) + path = name.to_s + ".rb" eachdir do |dir| @@ -87,12 +91,21 @@ class Puppet::Util::Autoload puts detail.backtrace end end - return false + return could_not_find(name) end end + return could_not_find(name) + end + + def could_not_find(name) + @could_not_find[name.to_s] = true return false end + def already_missed?(name) + @could_not_find.include?(name.to_s) + end + # Mark the named object as loaded. Note that this supports unqualified # queries, while we store the result as a qualified query in the class. def loaded(name, file)
This paste will be private.
From the Design Piracy series on my blog: