Class: Guard::Bosh::ChangeAssessor

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/bosh/change_assessor.rb

Overview

Determines the impact of a code change to enable a subset of files to be re-evaluated.

Instance Method Summary collapse

Constructor Details

#initialize(deployment_manifest) ⇒ ChangeAssessor

Returns a new instance of ChangeAssessor.



8
9
10
# File 'lib/guard/bosh/change_assessor.rb', line 8

def initialize(deployment_manifest)
  @deployment_manifest = deployment_manifest
end

Instance Method Details

#determine_scope(raw_paths) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/guard/bosh/change_assessor.rb', line 12

def determine_scope(raw_paths)
  paths = raw_paths.map { |p| Pathname.new(p) }
  return :all if paths.include?(@deployment_manifest)

  spec_scope = scope(jobs_for_paths(paths), :all_templates_for_job)
  return spec_scope if spec_scope

  jobs = paths.select { |p| template_path?(p) }.map do |t|
    template_job(t)
  end
  template_scope = scope(jobs, :single_template)
  return template_scope if template_scope

  :none
end