Sha256: cee1c411fd2149cc5b70c0cbc869b5a4fa6e0d43f2ad101d2ccf0703d97ff660

Contents?: true

Size: 602 Bytes

Versions: 22

Compression:

Stored size: 602 Bytes

Contents

module Buildkite
  module Builder
    class PluginManager
      def initialize
        @plugins = {}
      end

      def add(name, uri, default_attributes = {})
        name = name.to_s
        raise(ArgumentError, "Plugin already defined: #{name}") if @plugins.key?(name)

        @plugins[name] = Plugin.new(uri, default_attributes)
      end

      def build(name, attributes = {})
        plugin = @plugins[name.to_s]
        raise(ArgumentError, "Plugin is not registered: #{name}") unless plugin

        { plugin.uri => plugin.default_attributes.merge(attributes) }
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
buildkite-builder-4.1.2 lib/buildkite/builder/plugin_manager.rb
buildkite-builder-4.1.1 lib/buildkite/builder/plugin_manager.rb