2015-08-29 16:11:23 -07:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2015-09-02 00:50:52 +02:00
|
|
|
require 'digest'
|
2015-08-29 16:11:23 -07:00
|
|
|
|
2015-09-02 00:50:52 +02:00
|
|
|
module Vulcano::Plugins
|
|
|
|
|
|
|
|
class Backend
|
2015-09-08 12:59:36 +02:00
|
|
|
autoload :FileCommon, 'vulcano/plugins/backend_file_common'
|
|
|
|
autoload :LinuxFile, 'vulcano/plugins/backend_linux_file'
|
|
|
|
|
2015-09-05 16:07:54 +02:00
|
|
|
def self.name(name)
|
2015-09-02 00:50:52 +02:00
|
|
|
Vulcano::Plugins::Backend.__register(name, self)
|
|
|
|
end
|
|
|
|
|
2015-09-06 20:26:09 +02:00
|
|
|
# raise errors for all missing methods
|
|
|
|
%w{ file run_command os }.each do |m|
|
|
|
|
define_method(m.to_sym) do |*args|
|
|
|
|
fail NotImplementedError.new("Backend must implement the #{m}() method.")
|
2015-09-02 11:53:25 +02:00
|
|
|
end
|
2015-09-06 20:26:09 +02:00
|
|
|
end
|
2015-09-02 17:30:49 +02:00
|
|
|
|
2015-09-06 20:26:09 +02:00
|
|
|
def self.__register(id, obj)
|
2015-09-03 16:17:52 +02:00
|
|
|
Vulcano::Backend.registry[id] = obj
|
2015-09-02 00:50:52 +02:00
|
|
|
end
|
|
|
|
|
2015-08-29 16:11:23 -07:00
|
|
|
end
|
|
|
|
end
|