Class: RSpec::Pipeline::PipelineLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/pipeline/pipeline_loader.rb

Overview

This class loads the pipeline from a YAML file, also calling required methods to evaluate templates.

Instance Method Summary collapse

Constructor Details

#initialize(pipeline_name) ⇒ PipelineLoader

Returns a new instance of PipelineLoader.



9
10
11
12
# File 'lib/rspec/pipeline/pipeline_loader.rb', line 9

def initialize(pipeline_name)
  @pipeline_name = pipeline_name
  @template_loader = TemplateLoader.new
end

Instance Method Details

#loadObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rspec/pipeline/pipeline_loader.rb', line 14

def load
  pipeline = YAML.load_file(@pipeline_name)

  pipeline['stages'] = evaluate_stages(pipeline)

  pipeline['stages'].each do |stage|
    stage['jobs'] = evaluate_jobs(stage, pipeline)

    stage['jobs'].each do |job|
      job['steps'] = evaluate_steps(job, stage, pipeline)
    end
  end

  pipeline
end