buildkite-builder 3.7.0 → 3.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3804d4ee1257c87c370c1be4bf744c531521294c24a19eb48c87f55277e88754
4
- data.tar.gz: a7d49a4058d7873669aae486848be13ec8a84af758df0f74bf44560fcd686e5b
3
+ metadata.gz: 07cfaad01e1707290fd929b02cdad2b8b0510cfbebbb1ebbed60e6fd81c17fae
4
+ data.tar.gz: a521689c32580d0240f9cc545b8bcce09749ea09eb9922d716bd7d26c7fa0294
5
5
  SHA512:
6
- metadata.gz: c7d55f1b56b362778809522dc3d7c42567b19a89192074fd72c9b20261ab7d061e0f3498943f02082548bdb7bd41ae98db485bc09a335938675be2c78491a177
7
- data.tar.gz: e72473fbeb58287e8c2ec898490666777b54bb7e496faad5f80cc0c923d8bece96891ec6921342bb09191eef50a3a798185db6e710cd3169e507b70dff443836
6
+ metadata.gz: 33e4b16b7ec06ee1be8573a6b0ab71503a3311b29bb75e4e0ab7b37a97858a0932654dfae5cf05aa2612db20dc3bebe9d9f9ad444889625ef6bfd1da1107ec27
7
+ data.tar.gz: feeff303efbe6e5aa742da8bd2b540a7518a823ce4d3d9f030a82ffcf6cb77704d74a556c77d0deedc1647230ac5186abad7ba2daa505b6a5dbba788b4e54ef1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.0
1
+ 3.8.0
@@ -14,10 +14,12 @@ module Buildkite
14
14
 
15
15
  attr_reader :context
16
16
  attr_reader :options
17
+ attr_reader :option_block
17
18
 
18
- def initialize(context, **options)
19
+ def initialize(context, **options, &block)
19
20
  @context = context
20
21
  @options = options
22
+ @option_block = block
21
23
 
22
24
  prepare
23
25
  end
@@ -6,26 +6,34 @@ module Buildkite
6
6
 
7
7
  def initialize(context)
8
8
  @context = context
9
- @extensions = []
9
+ @extensions = {}
10
10
 
11
11
  @loader = Loaders::Extensions.load(@context.root)
12
12
  end
13
13
 
14
- def use(extension, native: false, **args)
14
+ def use(extension, native: false, **args, &block)
15
15
  unless extension < Buildkite::Builder::Extension
16
- raise "#{extension} must subclass Buildkite::Builder::Extension"
16
+ raise "#{extension.name} must subclass Buildkite::Builder::Extension"
17
17
  end
18
18
 
19
- @extensions.push(extension.new(@context, **args))
19
+ if @extensions[extension]
20
+ raise "#{extension.name} already registered"
21
+ end
22
+
23
+ @extensions[extension] = extension.new(@context, **args, &block)
20
24
  @context.dsl.extend(extension)
21
25
  end
22
26
 
23
27
  def build
24
- @extensions.each do |extension|
25
- log_build(extension.class.name) { extension.build }
28
+ @extensions.each do |extension_class, extension|
29
+ log_build(extension_class.name) { extension.build }
26
30
  end
27
31
  end
28
32
 
33
+ def find(klass)
34
+ @extensions.fetch(klass)
35
+ end
36
+
29
37
  private
30
38
 
31
39
  def log
@@ -3,8 +3,8 @@ module Buildkite
3
3
  module Extensions
4
4
  class Use < Extension
5
5
  dsl do
6
- def use(extension_class, **args)
7
- context.use(extension_class, **args)
6
+ def use(extension_class, **args, &block)
7
+ context.use(extension_class, **args, &block)
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildkite-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ngan Pham
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-11-07 00:00:00.000000000 Z
12
+ date: 2022-11-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow