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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 838d55bbb0f5156418d716123a70ca4332cf730897465522bf2035d5b6ec84b7
|
4
|
+
data.tar.gz: 03b21bc088a0973c209de3bfe345c5f90282ab254b75524d8b66b4f6e1fc837c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7deb7c43bac84aeef089f883e5dc53837cfcc2d536dcbd41d4f0058f1232c3695ba3755d1ea214c9c574a4b21490d374ebdca83cf82a3aa40c71865ded00c41
|
7
|
+
data.tar.gz: 0620d42e542547589c1f4dd34dae17c0881b9fdd336f9cebfc0a0eaf6fbcc54f6048de04230f6c4e5ba9fa6388cdb3d45c07789f7403e5b045fd63dbe62f7f76
|
data/bridgetown-builder.gemspec
CHANGED
@@ -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
|
-
|
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
|
data/lib/bridgetown-builder.rb
CHANGED
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.
|
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-
|
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.
|
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.
|
26
|
+
version: 2.0.0.beta3
|
27
27
|
description:
|
28
28
|
email: maintainers@bridgetownrb.com
|
29
29
|
executables: []
|