Class: Bosh::Cli::DeploymentManifestCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/deployment_manifest_compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_manifest) ⇒ DeploymentManifestCompiler


7
8
9
10
# File 'lib/cli/deployment_manifest_compiler.rb', line 7

def initialize(raw_manifest)
  @raw_manifest = raw_manifest
  @properties = {}
end

Instance Attribute Details

#propertiesObject

Returns the value of attribute properties


5
6
7
# File 'lib/cli/deployment_manifest_compiler.rb', line 5

def properties
  @properties
end

Instance Method Details

#property(name) ⇒ Object


12
13
14
15
# File 'lib/cli/deployment_manifest_compiler.rb', line 12

def property(name)
  @properties[name] || raise(UndefinedProperty,
                             "Cannot resolve deployment property '#{name}'")
end

#resultObject


17
18
19
20
21
22
# File 'lib/cli/deployment_manifest_compiler.rb', line 17

def result
  ERB.new(@raw_manifest).result(binding.taint)
rescue SyntaxError => e
  raise MalformedManifest,
        "Deployment manifest contains a syntax error\n" + e.to_s
end