Sha256: 56670b1452233b1a7a6fc8b777f43c487829a91f2856e0a48c9c22e8a9ff5bde

Contents?: true

Size: 938 Bytes

Versions: 22

Compression:

Stored size: 938 Bytes

Contents

module Buildkite
  module Builder
    module Extensions
      class Plugins < Extension
        attr_reader :manager

        dsl do
          def plugin(name, uri, default_attributes = {})
            context.extensions.find(Buildkite::Builder::Extensions::Plugins).manager.add(name, uri, default_attributes)
          end
        end

        def prepare
          @manager = PluginManager.new
        end

        def build
          context.data.steps.each(:command) do |step|
            next unless step.has?(:plugins)

            step.get(:plugins).map! do |plugin|
              resource, attributes = extract_resource_and_attributes(plugin)
              resource.is_a?(Symbol) ? manager.build(resource, attributes) : plugin
            end
          end
        end

        private

        def extract_resource_and_attributes(plugin)
          [plugin.keys.first, plugin.values.first]
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
buildkite-builder-4.15.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.14.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.13.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.12.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.11.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.10.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.8.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.7.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.6.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.5.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.4.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.3.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.2.5 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.2.4 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.2.3 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.2.2 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.2.1 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.2.0 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.1.2 lib/buildkite/builder/extensions/plugins.rb
buildkite-builder-4.1.1 lib/buildkite/builder/extensions/plugins.rb