mirror of
https://github.com/inspec/inspec
synced 2024-12-21 02:23:13 +00:00
e3373679ec
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
26 lines
669 B
Ruby
26 lines
669 B
Ruby
# encoding: utf-8
|
|
|
|
require 'digest'
|
|
|
|
module Vulcano::Plugins
|
|
class Backend
|
|
autoload :FileCommon, 'vulcano/plugins/backend_file_common'
|
|
autoload :LinuxFile, 'vulcano/plugins/backend_linux_file'
|
|
CommandResult = Struct.new(:stdout, :stderr, :exit_status)
|
|
|
|
def self.name(name)
|
|
Vulcano::Plugins::Backend.__register(name, self)
|
|
end
|
|
|
|
# raise errors for all missing methods
|
|
%w{ file run_command os }.each do |m|
|
|
define_method(m.to_sym) do |*_|
|
|
fail NotImplementedError, "Backend must implement the #{m}() method."
|
|
end
|
|
end
|
|
|
|
def self.__register(id, obj)
|
|
Vulcano::Backend.registry[id] = obj
|
|
end
|
|
end
|
|
end
|