Sha256: 75b330d4bba7c190f87c7fa29d08529cbcb5f266de82b4f8b3f0041b6a3d5b16

Contents?: true

Size: 921 Bytes

Versions: 1

Compression:

Stored size: 921 Bytes

Contents

module Buildkite
  module Builder
    class Group
      include Buildkite::Pipelines::Attributes

      attr_reader :label
      attr_reader :data

      attribute :depends_on, append: true
      attribute :key

      def self.to_sym
        name.split('::').last.downcase.to_sym
      end

      def initialize(label, steps, &block)
        @label = label
        @data = Data.new
        @data.steps = StepCollection.new(
          steps.templates,
          steps.plugins
        )
        @data.notify = []

        @dsl = Dsl.new(self)
        @dsl.extend(Extensions::Steps)
        @dsl.extend(Extensions::Notify)
        instance_eval(&block)
      end

      def to_h
        attributes = super
        { group: label }.merge(attributes).merge(data.to_definition)
      end

      def method_missing(method_name, *_args, &_block)
        @dsl.public_send(method_name, *_args, &_block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
buildkite-builder-2.0.0.beta1 lib/buildkite/builder/group.rb