bridgetown-builder 2.0.0.beta1 → 2.0.0.beta3

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: be80790b8d2984c7d6fd2eb4e1b8a00ab76aff9130b25a3cd4064dd3bbadfd82
4
- data.tar.gz: b96958d6a9b1bd6cdc1a180af7ae53f54069290d7e679a0ec0adcfc0d85835b5
3
+ metadata.gz: 838d55bbb0f5156418d716123a70ca4332cf730897465522bf2035d5b6ec84b7
4
+ data.tar.gz: 03b21bc088a0973c209de3bfe345c5f90282ab254b75524d8b66b4f6e1fc837c
5
5
  SHA512:
6
- metadata.gz: d428ae3dd232c91771cbe169510daaddb332d62421003ca877c8c7d0c6dc176d5ad20640bc6f0d2070f0adf5189a6ce62cbe969e3905c0de2578931fd55d4f9e
7
- data.tar.gz: 06ce5dd04af8f8c25277200d6f22d7754ad2f0436dbcf83ef3725fb245f05a21eb826b556976bd99e8e768e741dec90f86ca571b956bb6a5a6b06047b679fd05
6
+ metadata.gz: b7deb7c43bac84aeef089f883e5dc53837cfcc2d536dcbd41d4f0058f1232c3695ba3755d1ea214c9c574a4b21490d374ebdca83cf82a3aa40c71865ded00c41
7
+ data.tar.gz: 0620d42e542547589c1f4dd34dae17c0881b9fdd336f9cebfc0a0eaf6fbcc54f6048de04230f6c4e5ba9fa6388cdb3d45c07789f7403e5b045fd63dbe62f7f76
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../bridgetown-core/lib/bridgetown-core/version"
3
+ require_relative "../bridgetown-foundation/lib/bridgetown/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "bridgetown-builder"
@@ -4,6 +4,10 @@ module Bridgetown
4
4
  module Builders
5
5
  module DSL
6
6
  module Generators
7
+ # Set up a new generator based on the block or method provided which will run alongside
8
+ # other generators during the build process
9
+ #
10
+ # @param method_name [Symbol] use a Builder method rather than a block to run
7
11
  def generator(method_name = nil, &block)
8
12
  block = method(method_name) if method_name.is_a?(Symbol)
9
13
  local_name = name # pull the name method into a local variable
@@ -5,9 +5,15 @@ module Bridgetown
5
5
  module DSL
6
6
  module Helpers
7
7
  def helpers
8
- @helpers # could be nil
8
+ @helpers # could be nil. gets set once a helper method is actually called
9
9
  end
10
10
 
11
+ # Define a helper for use in view templates, alongside built-in helpers, using either a
12
+ # builder method or a block
13
+ #
14
+ # @param helper_name [Symbol] name of the helper
15
+ # @param method_name [Symbol] name of a Builder method to use, if block isn't provided
16
+ # and the method is named different from the helper
11
17
  def helper(helper_name, method_name = nil, &block)
12
18
  m = Module.new
13
19
 
@@ -4,6 +4,13 @@ module Bridgetown
4
4
  module Builders
5
5
  module DSL
6
6
  module Hooks
7
+ # Define a hook to run at some point during the build process
8
+ #
9
+ # @param owner [Symbol] name of the owner (`:site`, `:resource`, etc.)
10
+ # @param event [Symbol] name of the event (`:pre_read`, `:post_render`, etc.)
11
+ # @param method_name [Symbol] name of a Builder method to use, if block isn't provided
12
+ # @param priority [Integer, Symbol] either `:low`, `:normal`, or `:high`, or an integer.
13
+ # Default is normal (20)
7
14
  def hook(
8
15
  owner,
9
16
  event,
@@ -17,9 +24,13 @@ module Bridgetown
17
24
  functions << { name:, hook: [owner, event, priority, hook_block] }
18
25
  end
19
26
 
27
+ # Define a site post_read hook and add data returned by the block to the site data/signals
20
28
  def add_data(data_key)
21
29
  hook(:site, :post_read) do
22
- site.data[data_key] = yield
30
+ yield.tap do |value|
31
+ site.data[data_key] = value
32
+ site.signals[data_key] = value
33
+ end
23
34
  end
24
35
  end
25
36
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bridgetown-core"
4
- require "bridgetown-core/version"
5
4
 
6
5
  module Bridgetown
7
6
  module Builders
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta1
4
+ version: 2.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-02 00:00:00.000000000 Z
11
+ date: 2024-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0.beta1
19
+ version: 2.0.0.beta3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0.beta1
26
+ version: 2.0.0.beta3
27
27
  description:
28
28
  email: maintainers@bridgetownrb.com
29
29
  executables: []