class Inspec::FileProvider
def self.for_path(path)
def self.for_path(path) if path.is_a?(Hash) MockProvider.new(path) elsif File.directory?(path) DirProvider.new(path) elsif File.exist?(path) && path.end_with?('.tar.gz', 'tgz') TarProvider.new(path) elsif File.exist?(path) && path.end_with?('.zip') ZipProvider.new(path) elsif File.exist?(path) DirProvider.new(path) else fail "No file provider for the provided path: #{path}" end end
def files
def files fail "Fetcher #{self} does not implement `files()`. This is required." end
def initialize(_path)
def initialize(_path) end
def read(_file)
def read(_file) fail "#{self} does not implement `read(...)`. This is required." end
def relative_provider
def relative_provider RelativeFileProvider.new(self) end