2015-08-29 23:11:23 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2015-09-01 22:50:52 +00:00
|
|
|
require 'digest'
|
2015-08-29 23:11:23 +00:00
|
|
|
|
2015-09-01 22:50:52 +00:00
|
|
|
module Vulcano::Plugins
|
|
|
|
|
|
|
|
class Backend
|
2015-09-08 10:59:36 +00:00
|
|
|
autoload :FileCommon, 'vulcano/plugins/backend_file_common'
|
|
|
|
autoload :LinuxFile, 'vulcano/plugins/backend_linux_file'
|
|
|
|
|
2015-09-05 14:07:54 +00:00
|
|
|
def self.name(name)
|
2015-09-01 22:50:52 +00:00
|
|
|
Vulcano::Plugins::Backend.__register(name, self)
|
|
|
|
end
|
|
|
|
|
2015-09-06 18:26:09 +00: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 09:53:25 +00:00
|
|
|
end
|
2015-09-06 18:26:09 +00:00
|
|
|
end
|
2015-09-02 15:30:49 +00:00
|
|
|
|
2015-09-06 18:26:09 +00:00
|
|
|
def self.__register(id, obj)
|
2015-09-03 14:17:52 +00:00
|
|
|
Vulcano::Backend.registry[id] = obj
|
2015-09-01 22:50:52 +00:00
|
|
|
end
|
|
|
|
|
2015-08-29 23:11:23 +00:00
|
|
|
end
|
|
|
|
end
|