class Guard::Bosh::TemplateChecker
Encapsulates building the apply spec, and rendering job templates against it to identify errors.
Public Class Methods
apply_specification(deployment_manifest, release_dir)
click to toggle source
# File lib/guard/bosh/template_checker.rb, line 54 def self.apply_specification(deployment_manifest, release_dir) ApplySpecification.new( deployment_manifest: deployment_manifest, network_generator: NetworkGenerator.new, package_resolver: PackageResolver.new(release_dir) ) end
build(deployment_manifest:, release_dir:)
click to toggle source
# File lib/guard/bosh/template_checker.rb, line 35 def self.build(deployment_manifest:, release_dir:) new( deployment_manifest: deployment_manifest, properties_calculator: properties_calculator(deployment_manifest, release_dir), apply_specification: apply_specification(deployment_manifest, release_dir), template_renderer: TemplateRenderer.new ) end
new(deployment_manifest:, properties_calculator:, apply_specification:, template_renderer:)
click to toggle source
# File lib/guard/bosh/template_checker.rb, line 15 def initialize(deployment_manifest:, properties_calculator:, apply_specification:, template_renderer:) @deployment_manifest = deployment_manifest @properties_calculator = properties_calculator @apply_specification = apply_specification @template_renderer = template_renderer end
properties_calculator(deployment_manifest, release_dir)
click to toggle source
# File lib/guard/bosh/template_checker.rb, line 46 def self.properties_calculator(deployment_manifest, release_dir) EffectivePropertiesCalculator.new(loaders: [ JobDefaultPropertiesLoader.new(release_dir: release_dir), GlobalPropertiesLoader.new(deployment_manifest: deployment_manifest), JobPropertiesLoader.new(deployment_manifest: deployment_manifest) ]) end
Public Instance Methods
check(manifest_job_name:, job_name:, template:)
click to toggle source
# File lib/guard/bosh/template_checker.rb, line 25 def check(manifest_job_name:, job_name:, template:) properties = @properties_calculator.calculate_effective_properties( manifest_job_name: manifest_job_name, job_name: job_name) apply_spec = @apply_specification.generate( properties: properties, job_name: manifest_job_name ) @template_renderer.render(context: apply_spec, template: template) end