Sha256: 1dcc2215cced0913844f22dbe61b2b07f20f2476f0b7c362c9d25b6d8331c9d1

Contents?: true

Size: 606 Bytes

Versions: 3

Compression:

Stored size: 606 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: #{resource}") unless plugin

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
buildkite-builder-4.1.0 lib/buildkite/builder/plugin_manager.rb
buildkite-builder-4.0.0 lib/buildkite/builder/plugin_manager.rb
buildkite-builder-3.9.0 lib/buildkite/builder/plugin_manager.rb