class Inspec::Plugins::Fetcher
those fetchers.
class because the caller will never actually get an instance of
Fetchers in (2) do not need to implement the functions in this
then call the resolve_next method with a modified target hash.
examples), and (2) fetchers that only implement self.resolve and
implement this entire API (see the Git or Url fetchers for
In general, there are two kinds of fetchers. (1) Fetchers that
source to a local directory or file provided by the user.
An Inspec::Plugins::Fetcher is responsible for fetching a remote
def self.plugin_registry
def self.plugin_registry Inspec::Fetcher end
def archive_path
profile.
FileProvider to get access to the files in the fetched
The path to the archive on disk. This can be passed to a
def archive_path raise "Fetcher #{self} does not implement `archive_path()`. This is required." end
def cache_key
The unique key based on the content of the remote archive.
def cache_key raise "Fetcher #{self} does not implement `cache_key()`. This is required for terminal fetchers." end
def fetch(_path)
/foo/bar/baz.zip
/foo/bar/baz.tar.gz: A profile tarball, or
/foo/bar/baz/: A profile directory, or
/foo/bar/baz, the fetcher can create:
provided path as a partial filename. That is, if you pass
Fetches the remote source to a local source, using the
def fetch(_path) raise "Fetcher #{self} does not implement `fetch()`. This is required." end
def relative_target
@returns [Inspec::RelativeFileProvider]
Inspec, don't depend on it in new plugins.
Deprecated: This function may be removed in future versions of
party plugins.
relative_target is provided to keep compatibility with 3rd
def relative_target file_provider = Inspec::FileProvider.for_path(archive_path) file_provider.relative_provider end
def resolved_source
tag will be resolved to an exact revision.
reference where possible. For example, in the Git provide, a
ambigious references provided by the user resolved to an exact
The full specification of the remote source, with any
def resolved_source raise "Fetcher #{self} does not implement `resolved_source()`. This is required for terminal fetchers." end
def writable?
def writable? false end