class Inspec::Profile

def archive(opts)

assumes that the profile was checked before
generates a archive of a folder profile
def archive(opts)
  # check if file exists otherwise overwrite the archive
  dst = archive_name(opts)
  if dst.exist? && !opts[:overwrite]
    @logger.info "Archive #{dst} exists already. Use --overwrite."
    return false
  end
  # remove existing archive
  File.delete(dst) if dst.exist?
  @logger.info "Generate archive #{dst}."
  # filter files that should not be part of the profile
  # TODO ignore all .files, but add the files to debug output
  # display all files that will be part of the archive
  @logger.debug 'Add the following files to archive:'
  root_path = @source_reader.target.prefix
  files = @source_reader.target.files
  files.each { |f| @logger.debug '    ' + f }
  if opts[:zip]
    # generate zip archive
    require 'inspec/archive/zip'
    zag = Inspec::Archive::ZipArchiveGenerator.new
    zag.archive(root_path, files, dst)
  else
    # generate tar archive
    require 'inspec/archive/tar'
    tag = Inspec::Archive::TarArchiveGenerator.new
    tag.archive(root_path, files, dst)
  end
  @logger.info 'Finished archive generation.'
  true
end