mirror of
https://github.com/inspec/inspec
synced 2024-11-30 16:39:20 +00:00
85cbe713d7
This adds a new git fetcher. In doing so, it also refactors how the fetchers work a bit to better support fetchers that need to resolve user-provided sources to fully specified sources appropriate for a lockfile. Signed-off-by: Steven Danna <steve@chef.io>
31 lines
478 B
Ruby
31 lines
478 B
Ruby
# encoding: utf-8
|
|
# author: Dominik Richter
|
|
# author: Christoph Hartmann
|
|
|
|
module Fetchers
|
|
class Mock < Inspec.fetcher(1)
|
|
name 'mock'
|
|
priority 0
|
|
|
|
def self.resolve(target)
|
|
return nil unless target.is_a? Hash
|
|
new(target)
|
|
end
|
|
|
|
def initialize(data)
|
|
@data = data
|
|
end
|
|
|
|
def fetch(_path)
|
|
archive_path
|
|
end
|
|
|
|
def archive_path
|
|
{ mock: @data }
|
|
end
|
|
|
|
def resolved_source
|
|
{ mock_fetcher: true }
|
|
end
|
|
end
|
|
end
|