Class: Buildkite::Builder::ExtensionManager
- Inherits:
-
Object
- Object
- Buildkite::Builder::ExtensionManager
- Includes:
- LoggingUtils
- Defined in:
- lib/buildkite/builder/extension_manager.rb
Instance Method Summary collapse
- #all ⇒ Object
- #build ⇒ Object
- #find(klass) ⇒ Object
-
#initialize(context) ⇒ ExtensionManager
constructor
A new instance of ExtensionManager.
- #use(extension, native: false, **args, &block) ⇒ Object
Methods included from LoggingUtils
Constructor Details
#initialize(context) ⇒ ExtensionManager
Returns a new instance of ExtensionManager.
7 8 9 10 11 12 |
# File 'lib/buildkite/builder/extension_manager.rb', line 7 def initialize(context) @context = context @extensions = {} Loaders::Extensions.load(@context.root) end |
Instance Method Details
#all ⇒ Object
37 38 39 |
# File 'lib/buildkite/builder/extension_manager.rb', line 37 def all @extensions.keys end |
#build ⇒ Object
27 28 29 30 31 |
# File 'lib/buildkite/builder/extension_manager.rb', line 27 def build @extensions.each do |extension_class, extension| log_build(extension_class.name) { extension.build } end end |
#find(klass) ⇒ Object
33 34 35 |
# File 'lib/buildkite/builder/extension_manager.rb', line 33 def find(klass) @extensions.fetch(klass) end |
#use(extension, native: false, **args, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/buildkite/builder/extension_manager.rb', line 14 def use(extension, native: false, **args, &block) unless extension < Buildkite::Builder::Extension raise "#{extension.name} must subclass Buildkite::Builder::Extension" end if @extensions[extension] raise "#{extension.name} already registered" end @extensions[extension] = extension.new(@context, **args, &block) @context.dsl.extend(extension) end |