class GCI::Pipeline
Attributes
gitlab_ci_file[W]
image[RW]
jobs[R]
stages[RW]
variables[RW]
workflow[RW]
Public Class Methods
new() { |self| ... }
click to toggle source
# File lib/gci/pipeline.rb, line 9 def initialize @jobs = Job::Collection.new @stages = %i[build test deploy] @gitlab_ci_file = 'child.gitlab-ci.yml' yield(self) if block_given? end
Public Instance Methods
to_h()
click to toggle source
# File lib/gci/pipeline.rb, line 23 def to_h data = {} data.merge!(stages: stages.map(&:to_s)) data.merge!(image: @image) if @image.present? data.merge!(workflow: @workflow) if @workflow.present? data.merge!(@jobs.to_h) data end
to_yaml()
click to toggle source
# File lib/gci/pipeline.rb, line 32 def to_yaml to_h.to_yaml end
write()
click to toggle source
# File lib/gci/pipeline.rb, line 17 def write File.open(@gitlab_ci_file, 'wb') do |file| file.write(to_yaml) end end