Class: Isono::ResourceManifest

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/isono/resource_manifest.rb

Defined Under Namespace

Modules: MonitorHelper, RakeHelper Classes: Loader, StateItem, TaskBlock

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logger

included, initialize

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

#configObject (readonly)

Returns the value of attribute config.



131
132
133
# File 'lib/isono/resource_manifest.rb', line 131

def config
  @config
end

#descriptionObject

Returns the value of attribute description.



132
133
134
# File 'lib/isono/resource_manifest.rb', line 132

def description
  @description
end

#entry_stateObject (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_stateObject (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

#helpersObject (readonly)

Returns the value of attribute helpers.



130
131
132
# File 'lib/isono/resource_manifest.rb', line 130

def helpers
  @helpers
end

#instance_dataObject

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_pathObject (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

#nameObject

Returns the value of attribute name.



132
133
134
# File 'lib/isono/resource_manifest.rb', line 132

def name
  @name
end

#resource_root_pathObject (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_monitorObject

Returns the value of attribute state_monitor.



132
133
134
# File 'lib/isono/resource_manifest.rb', line 132

def state_monitor
  @state_monitor
end

#stmObject

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.expand_path(path, @resource_root_path)
              end
  unless $LOAD_PATH.member? real_path
    load_path << path
    $LOAD_PATH.unshift real_path
  end
end

#instance_data_pathObject



145
146
147
# File 'lib/isono/resource_manifest.rb', line 145

def instance_data_path
  File.expand_path('instance_data.yml', @resource_root_path)
end