Class: Guard::Bosh

Inherits:
Plugin
  • Object
show all
Defined in:
lib/guard/bosh.rb,
lib/guard/bosh/notifier.rb,
lib/guard/bosh/job_repository.rb,
lib/guard/bosh/change_assessor.rb,
lib/guard/bosh/package_resolver.rb,
lib/guard/bosh/template_checker.rb,
lib/guard/bosh/network_generator.rb,
lib/guard/bosh/template_renderer.rb,
lib/guard/bosh/apply_specification.rb,
lib/guard/bosh/job_properties_loader.rb,
lib/guard/bosh/global_properties_loader.rb,
lib/guard/bosh/job_default_properties_loader.rb,
lib/guard/bosh/effective_properties_calculator.rb

Overview

Guard BOSH Plugin

Defined Under Namespace

Classes: ApplySpecification, ChangeAssessor, EffectivePropertiesCalculator, GlobalPropertiesLoader, JobDefaultPropertiesLoader, JobPropertiesLoader, JobRepository, NetworkGenerator, Notifier, PackageResolver, TemplateChecker, TemplateRenderer

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Bosh



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/guard/bosh.rb', line 22

def initialize(options = {})
  super

  unless options.key?(:deployment_manifest)
    fail 'Please specify the deployment_manifest in your Guardfile'
  end

  @deployment_manifest = Pathname.new(options[:deployment_manifest])
  @change_assessor = options[:change_assessor]
  @job_repository = options[:job_repository]
  @template_checker = options[:template_checker]
  @notifier = options[:notifier]
end

Instance Method Details

#run_allObject



41
42
43
44
# File 'lib/guard/bosh.rb', line 41

def run_all
  errors = render_all_job_templates
  notify_errors(errors)
end

#run_on_modifications(paths) ⇒ Object

rubocop:disable Metrics/MethodLength



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/guard/bosh.rb', line 47

def run_on_modifications(paths)
  change_scope, job_name = @change_assessor.determine_scope(paths)
  errors = case change_scope
           when :all
             reload_deployment_manifest
             render_all_job_templates
           when :all_templates_for_job
             render_templates_for_job(
               job_name, @job_repository.template_paths(job_name))
           when :single_template
             render_templates_for_job(job_name, paths)
           end
  notify_errors(errors)
end

#startObject



36
37
38
39
# File 'lib/guard/bosh.rb', line 36

def start
  reload_deployment_manifest
  @notifier = Notifier.new
end