class Bosh::Workspace::ManifestBuilder

Attributes

merge_tool[R]

Public Class Methods

build(project_deployment, work_dir) click to toggle source
# File lib/bosh/workspace/manifest_builder.rb, line 5
def self.build(project_deployment, work_dir)
  manifest_builder = ManifestBuilder.new(project_deployment, work_dir)
  manifest_builder.merge_templates
end
new(project_deployment, work_dir) click to toggle source
# File lib/bosh/workspace/manifest_builder.rb, line 10
def initialize(project_deployment, work_dir)
  @project_deployment = project_deployment
  @merge_tool = @project_deployment.merge_tool
  @work_dir = work_dir
end

Public Instance Methods

merge_templates() click to toggle source
# File lib/bosh/workspace/manifest_builder.rb, line 16
def merge_templates
  @merge_tool.merge(template_paths, @project_deployment.merged_file)
end

Private Instance Methods

hidden_dir_path(name) click to toggle source
# File lib/bosh/workspace/manifest_builder.rb, line 38
def hidden_dir_path(name)
  dir = File.join(@work_dir, ".#{name.to_s}")
  Dir.mkdir(dir) unless File.exists? dir
  dir
end
hidden_file_path(type) click to toggle source
# File lib/bosh/workspace/manifest_builder.rb, line 34
def hidden_file_path(type)
  File.join(hidden_dir_path(type), "#{@project_deployment.name}.yml")
end
stub_file_path() click to toggle source
# File lib/bosh/workspace/manifest_builder.rb, line 28
def stub_file_path
  path = hidden_file_path(:stubs)
  StubFile.create(path, @project_deployment)
  path
end
template_path(template) click to toggle source

TODO move to template validator which should have access to @work_dir

# File lib/bosh/workspace/manifest_builder.rb, line 45
def template_path(template)
  path = File.join(@work_dir, "templates", template)
  err("Template does not exist: #{template}") unless File.exists? path
  path
end
template_paths() click to toggle source
# File lib/bosh/workspace/manifest_builder.rb, line 22
def template_paths
  @template_paths ||= @project_deployment.templates.map do |t|
    template_path(t)
  end.push(stub_file_path)
end