Class: Isono::ResourceManifest::Loader
- Inherits:
-
Object
- Object
- Isono::ResourceManifest::Loader
show all
- Includes:
- Logger
- Defined in:
- lib/isono/resource_manifest.rb
Overview
DSL to define a new resource manifest.
Defined Under Namespace
Classes: EntryState, ExitState
Instance Method Summary
collapse
Methods included from Logger
included, initialize
Constructor Details
#initialize(m) ⇒ Loader
Returns a new instance of Loader.
15
16
17
|
# File 'lib/isono/resource_manifest.rb', line 15
def initialize(m)
@manifest = m
end
|
Instance Method Details
#description(desc) ⇒ Object
Also known as:
desc
19
20
21
|
# File 'lib/isono/resource_manifest.rb', line 19
def description(desc)
@manifest.description = desc
end
|
#entry_state(state, &blk) ⇒ Object
36
37
38
39
|
# File 'lib/isono/resource_manifest.rb', line 36
def entry_state(state, &blk)
@manifest.entry_state[state] ||= StateItem.new
EntryState.new( @manifest.entry_state[state] ).instance_eval(&blk)
end
|
#exit_state(state, &blk) ⇒ Object
41
42
43
44
|
# File 'lib/isono/resource_manifest.rb', line 41
def exit_state(state, &blk)
@manifest.entry_state[state] ||= StateItem.new
ExitState.new( @manifest.entry_state[state] ).instance_eval(&blk)
end
|
#load_path(path) ⇒ Object
28
29
30
|
# File 'lib/isono/resource_manifest.rb', line 28
def load_path(path)
@manifest.append_load_path(path)
end
|
#manifest ⇒ Object
60
61
62
|
# File 'lib/isono/resource_manifest.rb', line 60
def manifest
@manifest
end
|
#name(name) ⇒ Object
32
33
34
|
# File 'lib/isono/resource_manifest.rb', line 32
def name(name)
@manifest.name = name
end
|
#plugin(klass) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/isono/resource_manifest.rb', line 46
def plugin(klass)
logger.debug("plugin: #{klass.to_s}")
if klass.const_defined?(:ClassMethods) && klass.const_get(:ClassMethods).is_a?(Module)
self.extend(klass.const_get(:ClassMethods))
end
if klass.const_defined?(:TaskMethods) && klass.const_get(:TaskMethods).is_a?(Module)
TaskBlock.class_eval {
include klass.const_get(:TaskMethods)
}
end
end
|
#statemachine(&blk) ⇒ Object
24
25
26
|
# File 'lib/isono/resource_manifest.rb', line 24
def statemachine(&blk)
@manifest.stm = Statemachine.build(&blk)
end
|