class PuppetGenerator::ExportFilters::BuildRoleIncludesForDirectory
Public Instance Methods
convert(objects)
click to toggle source
# File lib/puppet_generator/export_filters/build_role_includes_for_directory.rb, line 7 def convert(objects) objects.collect do |o| path = o[:name] next unless directory? path result = { name: path, includes: includes(path), } end.compact end
Private Instance Methods
directory?(path)
click to toggle source
# File lib/puppet_generator/export_filters/build_role_includes_for_directory.rb, line 30 def directory?(path) FileTest.directory? path end
includes(path)
click to toggle source
# File lib/puppet_generator/export_filters/build_role_includes_for_directory.rb, line 24 def includes(path) Dir.glob( File.join( path, '*.pp' ) ).collect { |f| File.basename( f, '.pp') }.sort rescue PuppetGenerator.logger.warn(self.class.name) { "Directory \"#{o[:name]}\" does not exist. There's no chance to get subentries for it. Therefor I use the name only and do not generate \"include\"-instructions." } end