Module: GOCD::PIPELINE_CONFIG

Included in:
Environment, Job, Pipeline, PipelineGroup, Stage
Defined in:
lib/gocd/pipeline_config/job.rb,
lib/gocd/pipeline_config/stage.rb,
lib/gocd/pipeline_config/pipeline.rb,
lib/gocd/pipeline_config/template.rb,
lib/gocd/pipeline_config/environment.rb,
lib/gocd/pipeline_config/pipeline_group.rb,
lib/gocd/pipeline_config/pipeline_config.rb,
lib/gocd/pipeline_config/repository/pipeline_config_repository.rb

Defined Under Namespace

Classes: Environment, Job, Pipeline, PipelineConfigRepository, PipelineGroup, Stage, Template

Instance Method Summary collapse

Instance Method Details

#environmentsObject



10
11
12
13
14
15
16
17
18
# File 'lib/gocd/pipeline_config/pipeline_config.rb', line 10

def environments
  raw_environments = to_array(pipeline_config_response["cruise"]["environments"]["environment"])
  environments = raw_environments.map do |environment|
    GOCD::PIPELINE_CONFIG::Environment.new(environment)
  end

  add_pipelines_to_environments environments, pipelines
  environments
end

#groupsObject



30
31
32
33
34
35
# File 'lib/gocd/pipeline_config/pipeline_config.rb', line 30

def groups
  raw_groups = to_array(pipeline_config_response['cruise']['pipelines'])
  raw_groups.map do |group|
    GOCD::PIPELINE_CONFIG::PipelineGroup.new(group)
  end
end

#pipeline_config_responseObject



37
38
39
# File 'lib/gocd/pipeline_config/pipeline_config.rb', line 37

def pipeline_config_response
  @config_response ||= PipelineConfigRepository.fetch_config
end

#pipelinesObject



20
21
22
23
# File 'lib/gocd/pipeline_config/pipeline_config.rb', line 20

def pipelines
  pipelines = groups.map { |group| group.pipelines }.flatten
  merge_pipelines_with_templates pipelines
end

#templatesObject



25
26
27
28
# File 'lib/gocd/pipeline_config/pipeline_config.rb', line 25

def templates
  raw_templates = to_array(pipeline_config_response["cruise"]["templates"]["pipeline"])
  raw_templates.map { |template| GOCD::PIPELINE_CONFIG::Template.new(template) }
end

#to_array(data) ⇒ Object



41
42
43
# File 'lib/gocd/pipeline_config/pipeline_config.rb', line 41

def to_array(data)
  [data].compact.flatten
end