module FileServing::TerminusHelper

Define some common methods for FileServing termini.

Public Instance Methods

path2instances(request, *paths) click to toggle source

Create model instances for all files in a fileset.

# File lib/puppet/file_serving/terminus_helper.rb, line 7
def path2instances(request, *paths)
  filesets = paths.collect do |path|
    # Filesets support indirector requests as an options collection
    Puppet::FileServing::Fileset.new(path, request)
  end

  Puppet::FileServing::Fileset.merge(*filesets).collect do |file, base_path|
    inst = model.new(base_path, :relative_path => file)
    inst.checksum_type = request.options[:checksum_type] if request.options[:checksum_type]
    inst.links = request.options[:links] if request.options[:links]
    inst.collect
    inst
  end
end