buildkite-builder 3.7.0 → 3.8.1

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: e0e8b5cc37e9923412be2b266a5e53d49291215d5c72deb9a4e71386557ec63c
4
+ data.tar.gz: f31cb6a1afca390b10a4867aada59b206b33581bed82ebe591b3b6e6a83c828c
5
5
  SHA512:
6
- metadata.gz: c7d55f1b56b362778809522dc3d7c42567b19a89192074fd72c9b20261ab7d061e0f3498943f02082548bdb7bd41ae98db485bc09a335938675be2c78491a177
7
- data.tar.gz: e72473fbeb58287e8c2ec898490666777b54bb7e496faad5f80cc0c923d8bece96891ec6921342bb09191eef50a3a798185db6e710cd3169e507b70dff443836
6
+ metadata.gz: b7f31586bca0d90aae646cba983f9d80cd05baa04cc64aefce9068766310a84a1bc3f47f59b505c1c7a8ad5981041941b75b597cb8bb13f0a1a3fbe3ac0e4f4f
7
+ data.tar.gz: 3a66afa04881cb65068a13fc2ba116770f396f3df949a45d6a0c46077fb909ea3f027180cbd16b3b973dcdcdf92dbaf05d0916875b6d81a8e2d0dbac9131aa77
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.0
1
+ 3.8.1
@@ -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
@@ -21,7 +21,8 @@ module Buildkite
21
21
  :artifacts,
22
22
  :plugins,
23
23
  :dsl,
24
- :data
24
+ :data,
25
+ :extensions
25
26
 
26
27
  def initialize(root, logger: nil)
27
28
  @root = root
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.1
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