diff options
| author | Luke Kanies <luke@puppetlabs.com> | 2010-07-07 23:34:10 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-07-09 12:31:45 -0700 |
| commit | 3c0059195fb2b1255f368d98021f4a99ecd121a6 (patch) | |
| tree | ee22c31b02f14d267a24acce875f3f185fb16617 /lib/puppet/parser | |
| parent | cea2e5b3fe03de8ef56a97af25ef8b6dd7eb3d7d (diff) | |
Fix for #4178 - generalize autoloading to include .rb
This mostly modifies autoloading to look for files ending in either 'pp' or
'rb' using Dir globing with {,.pp,.rb} or .{pp,rb} as appropriate. It could
easily be extended to add support for other formats (e.g. xml) by adding them
to the globs (though, if this were to be done often, having a centralized list
of supported extensions would be a good (and easy) refactor).
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'lib/puppet/parser')
| -rw-r--r-- | lib/puppet/parser/files.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/puppet/parser/files.rb b/lib/puppet/parser/files.rb index 37a726524..aad74699f 100644 --- a/lib/puppet/parser/files.rb +++ b/lib/puppet/parser/files.rb @@ -24,11 +24,7 @@ module Puppet::Parser::Files # Than that would be a "no." end abspat = File::expand_path(start, cwd) - files = Dir.glob(abspat).reject { |f| FileTest.directory?(f) } - if files.size == 0 - files = Dir.glob(abspat + ".pp").reject { |f| FileTest.directory?(f) } - end - return [nil, files] + return [nil, Dir.glob(abspat + (File.extname(abspat).empty? ? '{,.pp,.rb}' : '' )).reject { |f| FileTest.directory?(f) }] end # Find the concrete file denoted by +file+. If +file+ is absolute, |
