Class: Isono::ResourceManifest
- Inherits:
-
Object
- Object
- Isono::ResourceManifest
- Includes:
- Logger
- Defined in:
- lib/isono/resource_manifest.rb
Defined Under Namespace
Modules: MonitorHelper, RakeHelper Classes: Loader, StateItem, TaskBlock
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#description ⇒ Object
Returns the value of attribute description.
-
#entry_state ⇒ Object
readonly
Returns the value of attribute entry_state.
-
#exit_state ⇒ Object
readonly
Returns the value of attribute exit_state.
-
#helpers ⇒ Object
readonly
Returns the value of attribute helpers.
-
#instance_data ⇒ Object
Returns the value of attribute instance_data.
-
#load_path ⇒ Object
readonly
Returns the value of attribute load_path.
-
#name ⇒ Object
Returns the value of attribute name.
-
#resource_root_path ⇒ Object
readonly
Returns the value of attribute resource_root_path.
-
#state_monitor ⇒ Object
Returns the value of attribute state_monitor.
-
#stm ⇒ Object
Returns the value of attribute stm.
Class Method Summary collapse
Instance Method Summary collapse
- #append_load_path(path) ⇒ Object
-
#initialize(root_path) ⇒ ResourceManifest
constructor
A new instance of ResourceManifest.
- #instance_data_path ⇒ Object
Methods included from Logger
Constructor Details
#initialize(root_path) ⇒ ResourceManifest
Returns a new instance of ResourceManifest.
134 135 136 137 138 139 140 141 142 143 |
# File 'lib/isono/resource_manifest.rb', line 134 def initialize(root_path) @resource_root_path = root_path @entry_state = {} @exit_state = {} @helpers = {} @load_path = [] @config = Manifest::ConfigStruct.new append_load_path('lib') end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
131 132 133 |
# File 'lib/isono/resource_manifest.rb', line 131 def config @config end |
#description ⇒ Object
Returns the value of attribute description.
132 133 134 |
# File 'lib/isono/resource_manifest.rb', line 132 def description @description end |
#entry_state ⇒ Object (readonly)
Returns the value of attribute entry_state.
130 131 132 |
# File 'lib/isono/resource_manifest.rb', line 130 def entry_state @entry_state end |
#exit_state ⇒ Object (readonly)
Returns the value of attribute exit_state.
130 131 132 |
# File 'lib/isono/resource_manifest.rb', line 130 def exit_state @exit_state end |
#helpers ⇒ Object (readonly)
Returns the value of attribute helpers.
130 131 132 |
# File 'lib/isono/resource_manifest.rb', line 130 def helpers @helpers end |
#instance_data ⇒ Object
Returns the value of attribute instance_data.
132 133 134 |
# File 'lib/isono/resource_manifest.rb', line 132 def instance_data @instance_data end |
#load_path ⇒ Object (readonly)
Returns the value of attribute load_path.
130 131 132 |
# File 'lib/isono/resource_manifest.rb', line 130 def load_path @load_path end |
#name ⇒ Object
Returns the value of attribute name.
132 133 134 |
# File 'lib/isono/resource_manifest.rb', line 132 def name @name end |
#resource_root_path ⇒ Object (readonly)
Returns the value of attribute resource_root_path.
130 131 132 |
# File 'lib/isono/resource_manifest.rb', line 130 def resource_root_path @resource_root_path end |
#state_monitor ⇒ Object
Returns the value of attribute state_monitor.
132 133 134 |
# File 'lib/isono/resource_manifest.rb', line 132 def state_monitor @state_monitor end |
#stm ⇒ Object
Returns the value of attribute stm.
132 133 134 |
# File 'lib/isono/resource_manifest.rb', line 132 def stm @stm end |
Class Method Details
.load(path) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/isono/resource_manifest.rb', line 114 def self.load(path) root_path = File.dirname(path) manifest = new(root_path) # instance_data has to be loaded before manifest file # evaluation. if File.file?(manifest.instance_data_path) manifest.instance_data = YAML.load(File.read(manifest.instance_data_path)).freeze end logger.info("Loading resource.manifest: #{path}") buf = File.read(path) Loader.new(manifest).instance_eval(buf, path) manifest end |
Instance Method Details
#append_load_path(path) ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/isono/resource_manifest.rb', line 149 def append_load_path(path) real_path = if Pathname.new(path).absolute? path else File.(path, @resource_root_path) end unless $LOAD_PATH.member? real_path load_path << path $LOAD_PATH.unshift real_path end end |
#instance_data_path ⇒ Object
145 146 147 |
# File 'lib/isono/resource_manifest.rb', line 145 def instance_data_path File.('instance_data.yml', @resource_root_path) end |