Class: Buildkite::Builder::PluginManager

Inherits:
Object
  • Object
show all
Defined in:
lib/buildkite/builder/plugin_manager.rb

Instance Method Summary collapse

Constructor Details

#initializePluginManager

Returns a new instance of PluginManager.



4
5
6
# File 'lib/buildkite/builder/plugin_manager.rb', line 4

def initialize
  @plugins = {}
end

Instance Method Details

#add(name, uri, default_attributes = {}) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/buildkite/builder/plugin_manager.rb', line 8

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

#build(name, attributes = {}) ⇒ Object

Raises:

  • (ArgumentError)


15
16
17
18
19
20
# File 'lib/buildkite/builder/plugin_manager.rb', line 15

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