class Buildkite::Builder::StepCollection

Attributes

plugins[R]
steps[R]
templates[R]

Public Class Methods

new(templates, plugins) click to toggle source
# File lib/buildkite/builder/step_collection.rb, line 8
def initialize(templates, plugins)
  @templates = templates
  @plugins = plugins
  @steps = []
end

Public Instance Methods

add(step_class, template = nil, **args, &block) click to toggle source
# File lib/buildkite/builder/step_collection.rb, line 38
def add(step_class, template = nil, **args, &block)
  @steps.push(step_class.new(self, template, **args, &block)).last
end
each(*types) { |step| ... } click to toggle source
# File lib/buildkite/builder/step_collection.rb, line 14
def each(*types)
  types = types.flatten

  @steps.each do |step|
    if types.include?(step.class.to_sym)
      yield step
    elsif step.is_a?(Group)
      step.data.steps.each(*types) do |step|
        yield step
      end
    elsif types.empty?
      yield step
    end
  end
end
find(key) click to toggle source
# File lib/buildkite/builder/step_collection.rb, line 30
def find(key)
  @steps.find { |step| step.has?(:key) && step.key == key.to_s }
end
find!(key) click to toggle source
# File lib/buildkite/builder/step_collection.rb, line 34
def find!(key)
  find(key) || raise(ArgumentError, "Can't find step with key: #{key}")
end
push(step) click to toggle source
# File lib/buildkite/builder/step_collection.rb, line 42
def push(step)
  @steps.push(step)
end
to_definition() click to toggle source
# File lib/buildkite/builder/step_collection.rb, line 46
def to_definition
  @steps.map(&:to_h)
end