bridgetown-builder 1.1.0 → 1.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bridgetown-builder.gemspec +7 -0
- data/lib/bridgetown-builder/dsl/helpers.rb +14 -2
- data/lib/bridgetown-builder/dsl/inspectors.rb +1 -1
- data/lib/bridgetown-builder/dsl/liquid.rb +18 -2
- data/lib/bridgetown-builder/dsl/resources.rb +32 -0
- data/lib/bridgetown-builder/plugin.rb +5 -1
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9376f1f28e9fb611697fc7e18e912aa7918534b551cb4fa1ac7fc1ba0cbded12
|
4
|
+
data.tar.gz: 192427cc6d3cdd57f089ae762d015d2db4907011a954027abf1a2c5d0ea5934b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e8acc00410ec0a2e95a3b2826cf3b291c605f99dacf644aacdd5de02f621cb5aff37fc95ea8cc7e9bddb26d1f56838a719550bedef76379eb65be9e097a49b3
|
7
|
+
data.tar.gz: 310932710ced2d986c7fe2cb066a6e200be405e0931bd2154c81024a2424016c92b90bcd90096efe79047ee084c6124a86ecacefa8522b9492ff0e84621b7cd2
|
data/bridgetown-builder.gemspec
CHANGED
@@ -14,5 +14,12 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features)/!) }
|
15
15
|
spec.require_paths = ["lib"]
|
16
16
|
|
17
|
+
spec.metadata = {
|
18
|
+
"source_code_uri" => "https://github.com/bridgetownrb/bridgetown",
|
19
|
+
"bug_tracker_uri" => "https://github.com/bridgetownrb/bridgetown/issues",
|
20
|
+
"changelog_uri" => "https://github.com/bridgetownrb/bridgetown/releases",
|
21
|
+
"homepage_uri" => spec.homepage,
|
22
|
+
}
|
23
|
+
|
17
24
|
spec.add_dependency("bridgetown-core", Bridgetown::VERSION)
|
18
25
|
end
|
@@ -4,13 +4,21 @@ module Bridgetown
|
|
4
4
|
module Builders
|
5
5
|
module DSL
|
6
6
|
module Helpers
|
7
|
+
def helpers
|
8
|
+
@helpers # could be nil
|
9
|
+
end
|
10
|
+
|
7
11
|
def helper(helper_name, method_name = nil, helpers_scope: false, &block)
|
8
|
-
builder_self = self
|
9
12
|
m = Module.new
|
10
13
|
|
11
14
|
if block && helpers_scope
|
15
|
+
Deprecator.deprecation_message(
|
16
|
+
"The `helpers_scope' functionality is deprecated. Use the `helpers' builder " \
|
17
|
+
"method to access the helpers scope in your plugin."
|
18
|
+
)
|
12
19
|
m.define_method helper_name, &block
|
13
20
|
else
|
21
|
+
builder_self = self
|
14
22
|
method_name ||= helper_name unless block
|
15
23
|
unless method_name
|
16
24
|
method_name = :"__helper_#{helper_name}"
|
@@ -19,7 +27,11 @@ module Bridgetown
|
|
19
27
|
end
|
20
28
|
end
|
21
29
|
m.define_method helper_name do |*args, **kwargs, &block2|
|
22
|
-
builder_self.
|
30
|
+
prev_var = builder_self.instance_variable_get(:@helpers)
|
31
|
+
builder_self.instance_variable_set(:@helpers, self)
|
32
|
+
builder_self.send(method_name, *args, **kwargs, &block2).tap do
|
33
|
+
builder_self.instance_variable_set(:@helpers, prev_var)
|
34
|
+
end
|
23
35
|
end
|
24
36
|
end
|
25
37
|
|
@@ -4,13 +4,25 @@ module Bridgetown
|
|
4
4
|
module Builders
|
5
5
|
module DSL
|
6
6
|
module Liquid
|
7
|
+
def filters
|
8
|
+
@filters # could be nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def filters_context
|
12
|
+
filters&.instance_variable_get(:@context)
|
13
|
+
end
|
14
|
+
|
7
15
|
def liquid_filter(filter_name, method_name = nil, filters_scope: false, &block)
|
8
|
-
builder_self = self
|
9
16
|
m = Module.new
|
10
17
|
|
11
18
|
if block && filters_scope
|
19
|
+
Deprecator.deprecation_message(
|
20
|
+
"The `filters_scope' functionality is deprecated. Use the `filters' builder " \
|
21
|
+
"method to access the filters scope in your plugin."
|
22
|
+
)
|
12
23
|
m.define_method filter_name, &block
|
13
24
|
else
|
25
|
+
builder_self = self
|
14
26
|
method_name ||= filter_name unless block
|
15
27
|
unless method_name
|
16
28
|
method_name = :"__filter_#{filter_name}"
|
@@ -19,7 +31,11 @@ module Bridgetown
|
|
19
31
|
end
|
20
32
|
end
|
21
33
|
m.define_method filter_name do |*args, **kwargs|
|
22
|
-
builder_self.
|
34
|
+
prev_var = builder_self.instance_variable_get(:@filters)
|
35
|
+
builder_self.instance_variable_set(:@filters, self)
|
36
|
+
builder_self.send(method_name, *args, **kwargs).tap do
|
37
|
+
builder_self.instance_variable_set(:@filters, prev_var)
|
38
|
+
end
|
23
39
|
end
|
24
40
|
end
|
25
41
|
|
@@ -4,6 +4,10 @@ module Bridgetown
|
|
4
4
|
module Builders
|
5
5
|
module DSL
|
6
6
|
module Resources
|
7
|
+
def resource
|
8
|
+
@resource # could be nil
|
9
|
+
end
|
10
|
+
|
7
11
|
def add_resource(collection_name, path, &block) # rubocop:todo Metrics/AbcSize
|
8
12
|
data = Bridgetown::Utils::RubyFrontMatter.new(scope: self).tap do |fm|
|
9
13
|
fm.define_singleton_method(:___) do |hsh|
|
@@ -36,6 +40,34 @@ module Bridgetown
|
|
36
40
|
data
|
37
41
|
).as_resource_in_collection
|
38
42
|
end
|
43
|
+
|
44
|
+
def define_resource_method(method_name, class_scope: false, &block)
|
45
|
+
unless block
|
46
|
+
builder_self = self
|
47
|
+
block = proc do |*args, **kwargs, &block2|
|
48
|
+
prev_var = builder_self.instance_variable_get(:@resource)
|
49
|
+
builder_self.instance_variable_set(:@resource, self)
|
50
|
+
builder_self.send(method_name, *args, **kwargs, &block2).tap do
|
51
|
+
builder_self.instance_variable_set(:@resource, prev_var)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
m = Module.new
|
57
|
+
m.define_method method_name, &block
|
58
|
+
|
59
|
+
class_scope ? Bridgetown::Resource::Base.extend(m) : Bridgetown::Resource::Base.include(m)
|
60
|
+
end
|
61
|
+
|
62
|
+
def permalink_placeholder(key, &block)
|
63
|
+
Bridgetown::Resource::PermalinkProcessor.register_placeholder(
|
64
|
+
key, block
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
def placeholder_processors
|
69
|
+
Bridgetown::Resource::PermalinkProcessor.placeholder_processors
|
70
|
+
end
|
39
71
|
end
|
40
72
|
end
|
41
73
|
end
|
@@ -40,9 +40,13 @@ module Bridgetown
|
|
40
40
|
def initialize(name = nil, current_site = nil)
|
41
41
|
self.functions = Set.new
|
42
42
|
self.name = name || self.class.name
|
43
|
-
self.site = current_site || Bridgetown.
|
43
|
+
self.site = current_site || Bridgetown::Current.site
|
44
44
|
|
45
45
|
self.config = if defined?(self.class::CONFIG_DEFAULTS)
|
46
|
+
Deprecator.deprecation_message(
|
47
|
+
"Using `CONFIG_DEFAULTS' in your builder is deprecated. " \
|
48
|
+
"Switch to defining config data via an initializer instead."
|
49
|
+
)
|
46
50
|
Bridgetown::Utils.deep_merge_hashes(
|
47
51
|
self.class::CONFIG_DEFAULTS.with_dot_access, site.config
|
48
52
|
)
|
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: 1.
|
4
|
+
version: 1.2.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-02 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: 1.
|
19
|
+
version: 1.2.0.beta1
|
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: 1.
|
26
|
+
version: 1.2.0.beta1
|
27
27
|
description:
|
28
28
|
email: maintainers@bridgetownrb.com
|
29
29
|
executables: []
|
@@ -46,7 +46,11 @@ files:
|
|
46
46
|
homepage: https://github.com/bridgetownrb/bridgetown/tree/main/bridgetown-builder
|
47
47
|
licenses:
|
48
48
|
- MIT
|
49
|
-
metadata:
|
49
|
+
metadata:
|
50
|
+
source_code_uri: https://github.com/bridgetownrb/bridgetown
|
51
|
+
bug_tracker_uri: https://github.com/bridgetownrb/bridgetown/issues
|
52
|
+
changelog_uri: https://github.com/bridgetownrb/bridgetown/releases
|
53
|
+
homepage_uri: https://github.com/bridgetownrb/bridgetown/tree/main/bridgetown-builder
|
50
54
|
post_install_message:
|
51
55
|
rdoc_options: []
|
52
56
|
require_paths:
|
@@ -58,9 +62,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
62
|
version: '0'
|
59
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
64
|
requirements:
|
61
|
-
- - "
|
65
|
+
- - ">"
|
62
66
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
67
|
+
version: 1.3.1
|
64
68
|
requirements: []
|
65
69
|
rubygems_version: 3.1.4
|
66
70
|
signing_key:
|