Module: Tumugi::Plugin
- Defined in:
- lib/tumugi/plugin.rb,
lib/tumugi/plugin/task/external.rb,
lib/tumugi/plugin/atomic_local_file.rb,
lib/tumugi/plugin/local_file_system.rb,
lib/tumugi/plugin/target/local_file.rb,
lib/tumugi/plugin/file_system_target.rb
Defined Under Namespace
Classes: AtomicLocalFile, ExternalTask, FileSystemTarget, LocalFileSystem, LocalFileTarget
Constant Summary
collapse
- TARGET_REGISTRY =
Registry.new(:target, 'tumugi/plugin/target/')
- TASK_REGISTRY =
Registry.new(:task, 'tumugi/plugin/task/')
Class Method Summary
collapse
Class Method Details
.lookup_impl(kind, registry, type) ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/tumugi/plugin.rb', line 34
def self.lookup_impl(kind, registry, type)
obj = registry.lookup(type)
if obj.is_a?(Class)
obj
else
raise "#{kind} plugin '#{type}' is not a Class"
end
end
|
.lookup_target(type) ⇒ Object
26
27
28
|
# File 'lib/tumugi/plugin.rb', line 26
def self.lookup_target(type)
lookup_impl('target', TARGET_REGISTRY, type)
end
|
.lookup_task(type) ⇒ Object
30
31
32
|
# File 'lib/tumugi/plugin.rb', line 30
def self.lookup_task(type)
lookup_impl('task', TASK_REGISTRY, type)
end
|
.register_impl(kind, registry, type, value) ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/tumugi/plugin.rb', line 17
def self.register_impl(kind, registry, type, value)
if !value.is_a?(Class)
raise "Invalid implementation as #{kind} plugin: '#{type}'. It must be a Class."
end
registry.register(type, value)
Tumugi::Logger.instance.debug "registered #{kind} plugin '#{type}'"
nil
end
|
.register_target(type, klass) ⇒ Object
9
10
11
|
# File 'lib/tumugi/plugin.rb', line 9
def self.register_target(type, klass)
register_impl('target', TARGET_REGISTRY, type, klass)
end
|
.register_task(type, klass) ⇒ Object
13
14
15
|
# File 'lib/tumugi/plugin.rb', line 13
def self.register_task(type, klass)
register_impl('task', TASK_REGISTRY, type, klass)
end
|