bridgetown-core 2.0.0.beta3 → 2.0.0.beta5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bridgetown-core.gemspec +43 -42
- data/lib/bridgetown-core/collection.rb +5 -4
- data/lib/bridgetown-core/commands/base.rb +7 -0
- data/lib/bridgetown-core/commands/build.rb +29 -5
- data/lib/bridgetown-core/commands/console.rb +0 -1
- data/lib/bridgetown-core/commands/plugins.rb +4 -3
- data/lib/bridgetown-core/commands/start.rb +12 -2
- data/lib/bridgetown-core/component.rb +1 -1
- data/lib/bridgetown-core/concerns/intuitive_expectations.rb +67 -0
- data/lib/bridgetown-core/concerns/site/fast_refreshable.rb +15 -7
- data/lib/bridgetown-core/concerns/site/ssr.rb +1 -1
- data/lib/bridgetown-core/concerns/site/writable.rb +1 -0
- data/lib/bridgetown-core/concerns/viewable.rb +46 -0
- data/lib/bridgetown-core/configuration.rb +21 -9
- data/lib/bridgetown-core/configurations/gh-pages/gh-pages.yml +5 -5
- data/lib/bridgetown-core/configurations/minitesting.rb +24 -64
- data/lib/bridgetown-core/converters/erb_templates.rb +11 -7
- data/lib/bridgetown-core/converters/serbea_templates.rb +7 -4
- data/lib/bridgetown-core/front_matter/defaults.rb +6 -6
- data/lib/bridgetown-core/front_matter/loaders/ruby.rb +2 -2
- data/lib/bridgetown-core/front_matter/loaders/yaml.rb +2 -2
- data/lib/bridgetown-core/helpers.rb +2 -2
- data/lib/bridgetown-core/rack/boot.rb +7 -57
- data/lib/bridgetown-core/rack/default_config.ru +14 -0
- data/lib/bridgetown-core/rack/loader_hooks.rb +83 -0
- data/lib/bridgetown-core/rack/routes.rb +3 -2
- data/lib/bridgetown-core/resource/base.rb +1 -1
- data/lib/bridgetown-core/resource/relations.rb +3 -1
- data/lib/bridgetown-core/utils/initializers.rb +2 -2
- data/lib/bridgetown-core.rb +28 -8
- data/lib/roda/plugins/bridgetown_server.rb +12 -23
- data/lib/roda/plugins/bridgetown_ssr.rb +21 -3
- data/lib/roda/plugins/flashier.rb +57 -0
- data/lib/roda/plugins/generic_index.html +127 -0
- data/lib/roda/plugins/ssg.rb +3 -2
- data/lib/site_template/config/initializers.rb +2 -0
- metadata +24 -5
- data/lib/bridgetown-core/commands/doctor.rb +0 -147
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 640ad580e7362c34e924047d18d5aabc84ce83790f1ae6f31e69c5e486ac31a7
|
4
|
+
data.tar.gz: b0a955781229fdc4f87ca6f89cfc53990a821aac27d8d470cacf46a143db5ca7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49d47097b2dff1226b8ddf0b61191559a26d18745e5d15fafd0c51bd07eec35d406b370b0b16112df0bb3f9518660b8fa36d47cd0d707a534f34b0d195482b8c
|
7
|
+
data.tar.gz: 96f4cf0298dfb193494387ea3e6c7136613724bb70f58700a2df0b08c34e25dd1bff9f91428b8133869b4fe2b675a88026ea367584937f9b752d7d8be644b07c
|
data/bridgetown-core.gemspec
CHANGED
@@ -2,58 +2,59 @@
|
|
2
2
|
|
3
3
|
require_relative "../bridgetown-foundation/lib/bridgetown/version"
|
4
4
|
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "bridgetown-core"
|
7
|
+
spec.version = Bridgetown::VERSION
|
8
|
+
spec.license = "MIT"
|
9
|
+
spec.author = "Bridgetown Team"
|
10
|
+
spec.email = "maintainers@bridgetownrb.com"
|
11
|
+
spec.homepage = "https://www.bridgetownrb.com"
|
12
|
+
spec.summary = "A next-generation, progressive site generator & fullstack framework, powered by Ruby"
|
13
|
+
spec.description = "Bridgetown is a next-generation, progressive site generator & fullstack framework, powered by Ruby"
|
14
14
|
|
15
|
-
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
16
|
f.match(%r!^(benchmark|features|script|test)/!)
|
17
17
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
spec.executables = ["bridgetown", "bt"] # `bt` is a shortcut to `bridgetown` command
|
19
|
+
spec.bindir = "bin"
|
20
|
+
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
|
22
|
+
spec.metadata = {
|
23
23
|
"source_code_uri" => "https://github.com/bridgetownrb/bridgetown",
|
24
24
|
"bug_tracker_uri" => "https://github.com/bridgetownrb/bridgetown/issues",
|
25
25
|
"changelog_uri" => "https://github.com/bridgetownrb/bridgetown/releases",
|
26
|
-
"homepage_uri" =>
|
26
|
+
"homepage_uri" => spec.homepage,
|
27
27
|
"rubygems_mfa_required" => "true",
|
28
28
|
}
|
29
29
|
|
30
|
-
|
30
|
+
spec.rdoc_options = ["--charset=UTF-8"]
|
31
31
|
|
32
|
-
|
32
|
+
spec.required_ruby_version = ">= 3.1.0"
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
34
|
+
spec.add_dependency("activesupport", [">= 6.0", "< 8.0"])
|
35
|
+
spec.add_dependency("addressable", "~> 2.4")
|
36
|
+
spec.add_dependency("amazing_print", "~> 1.2")
|
37
|
+
spec.add_dependency("bridgetown-foundation", Bridgetown::VERSION)
|
38
|
+
spec.add_dependency("csv", "~> 3.2")
|
39
|
+
spec.add_dependency("dry-inflector", ">= 1.0")
|
40
|
+
spec.add_dependency("erubi", "~> 1.9")
|
41
|
+
spec.add_dependency("faraday", "~> 2.0")
|
42
|
+
spec.add_dependency("faraday-follow_redirects", "~> 0.3")
|
43
|
+
spec.add_dependency("i18n", "~> 1.0")
|
44
|
+
spec.add_dependency("irb", ">= 1.14")
|
45
|
+
spec.add_dependency("kramdown", "~> 2.1")
|
46
|
+
spec.add_dependency("kramdown-parser-gfm", "~> 1.0")
|
47
|
+
spec.add_dependency("liquid", [">= 5.0", "< 5.5"])
|
48
|
+
spec.add_dependency("listen", "~> 3.0")
|
49
|
+
spec.add_dependency("rack", ">= 3.0")
|
50
|
+
spec.add_dependency("rackup", "~> 2.0")
|
51
|
+
spec.add_dependency("rake", ">= 13.0")
|
52
|
+
spec.add_dependency("roda", "~> 3.46")
|
53
|
+
spec.add_dependency("rouge", [">= 3.0", "< 5.0"])
|
54
|
+
spec.add_dependency("serbea", "~> 2.1")
|
55
|
+
spec.add_dependency("signalize", "~> 1.3")
|
56
|
+
spec.add_dependency("streamlined", ">= 0.6.0")
|
57
|
+
spec.add_dependency("thor", "~> 1.1")
|
58
|
+
spec.add_dependency("tilt", "~> 2.0")
|
59
|
+
spec.add_dependency("zeitwerk", "~> 2.5")
|
59
60
|
end
|
@@ -55,13 +55,13 @@ module Bridgetown
|
|
55
55
|
# Iterate over Resources by delegating to `resources.each` (supports Enumerable)
|
56
56
|
def each(...) = resources.each(...)
|
57
57
|
|
58
|
-
#
|
58
|
+
# Delegates to `resources.last`
|
59
59
|
def last(...) = resources.last(...)
|
60
60
|
|
61
|
-
#
|
61
|
+
# Delegates to `resources.deconstruct`
|
62
62
|
def deconstruct = resources.deconstruct
|
63
63
|
|
64
|
-
#
|
64
|
+
# Delegates to `resources[]`
|
65
65
|
def [](...) = resources.[](...)
|
66
66
|
|
67
67
|
# Fetch the static files in this collection.
|
@@ -184,7 +184,8 @@ module Bridgetown
|
|
184
184
|
#
|
185
185
|
# @return [String]
|
186
186
|
def inspect
|
187
|
-
"#<#{self.class}
|
187
|
+
"#<#{self.class} #{label}: #{resources.count} metadata=#{metadata.inspect} " \
|
188
|
+
"static_files: #{static_files.count}>"
|
188
189
|
end
|
189
190
|
|
190
191
|
# Produce a sanitized label name
|
@@ -66,6 +66,13 @@ module Bridgetown
|
|
66
66
|
puts "Unknown task: #{cmd.split("[")[0]}\n\nHere's a list of tasks you can run:"
|
67
67
|
display_rake_tasks(rake)
|
68
68
|
end
|
69
|
+
rescue RuntimeError => e
|
70
|
+
# re-raise error unless it's an error through Minitest
|
71
|
+
raise e unless e.message.include?("ruby -Ilib:test")
|
72
|
+
|
73
|
+
Bridgetown.logger.error "test aborted!"
|
74
|
+
Bridgetown.logger.error e.message
|
75
|
+
exit(false)
|
69
76
|
end
|
70
77
|
end
|
71
78
|
end
|
@@ -50,11 +50,7 @@ module Bridgetown
|
|
50
50
|
if Bridgetown::Utils.frontend_bundler_type(config_options[:root_dir]) == :esbuild
|
51
51
|
Bridgetown::Utils.update_esbuild_autogenerated_config config_options
|
52
52
|
end
|
53
|
-
|
54
|
-
Rake.with_application do |rake|
|
55
|
-
rake.load_rakefile
|
56
|
-
rake["frontend:watcher"].invoke(true)
|
57
|
-
end
|
53
|
+
invoke_frontend_watcher_from_rake
|
58
54
|
end
|
59
55
|
|
60
56
|
@site = Bridgetown::Site.new(config_options)
|
@@ -95,6 +91,19 @@ module Bridgetown
|
|
95
91
|
#
|
96
92
|
# @param options [Bridgetown::Configuration] options loaded from config and/or CLI
|
97
93
|
def watch_site(config_options)
|
94
|
+
if config_options["url"]&.include?("://localhost")
|
95
|
+
require "socket"
|
96
|
+
external_ip = Socket.ip_address_list.find do |ai|
|
97
|
+
ai.ipv4? && !ai.ipv4_loopback?
|
98
|
+
end&.ip_address
|
99
|
+
scheme = config_options.bind&.split("://")&.first == "ssl" ? "https" : "http"
|
100
|
+
port = ENV.fetch("BRIDGETOWN_PORT", config_options.port)
|
101
|
+
Bridgetown.logger.info ""
|
102
|
+
Bridgetown.logger.info "Now serving at:", "#{scheme}://localhost:#{port}".magenta
|
103
|
+
Bridgetown.logger.info "", "#{scheme}://#{external_ip}:#{port}".magenta if external_ip
|
104
|
+
Bridgetown.logger.info ""
|
105
|
+
end
|
106
|
+
|
98
107
|
Bridgetown::Watcher.watch(@site, config_options)
|
99
108
|
end
|
100
109
|
|
@@ -112,6 +121,21 @@ module Bridgetown
|
|
112
121
|
plugins_dir = File.expand_path(config_options["plugins_dir"])
|
113
122
|
Bridgetown.logger.info "Custom Plugins:", plugins_dir if Dir.exist?(plugins_dir)
|
114
123
|
end
|
124
|
+
|
125
|
+
def invoke_frontend_watcher_from_rake
|
126
|
+
require "rake"
|
127
|
+
Rake.with_application do |rake|
|
128
|
+
begin
|
129
|
+
rake.raw_load_rakefile
|
130
|
+
rescue StandardError => e
|
131
|
+
unless e.message.include?("No Rakefile found")
|
132
|
+
Bridgetown.logger.error "Error Running Rake:", "#{e.message} (#{e.class})"
|
133
|
+
e.backtrace[0..1].each { |backtrace_line| Bridgetown.logger.info backtrace_line }
|
134
|
+
end
|
135
|
+
end
|
136
|
+
rake["frontend:watcher"].invoke(true) if rake.tasks.any? { _1.name == "frontend:watcher" }
|
137
|
+
end
|
138
|
+
end
|
115
139
|
end
|
116
140
|
end
|
117
141
|
end
|
@@ -27,15 +27,16 @@ module Bridgetown
|
|
27
27
|
|
28
28
|
pm = site.plugin_manager
|
29
29
|
|
30
|
-
plugins_list += pm.class.registered_plugins.
|
31
|
-
|
30
|
+
plugins_list += pm.class.registered_plugins.to_a
|
31
|
+
|
32
|
+
plugins_list.reject! do |plugin|
|
33
|
+
plugin.to_s.end_with?("site_builder.rb") || plugin.to_s == "init (Initializer)"
|
32
34
|
end
|
33
35
|
|
34
36
|
Bridgetown.logger.info("Registered Plugins:", plugins_list.length.to_s.yellow.bold)
|
35
37
|
|
36
38
|
plugins_list.each do |plugin|
|
37
39
|
plugin_desc = plugin.to_s
|
38
|
-
next if plugin_desc.ends_with?("site_builder.rb") || plugin_desc == "init (Initializer)"
|
39
40
|
|
40
41
|
if plugin.is_a?(Bridgetown::Configuration::Initializer)
|
41
42
|
Bridgetown.logger.info("", plugin_desc)
|
@@ -77,12 +77,14 @@ module Bridgetown
|
|
77
77
|
bt_bound_url = "http://#{bt_options.bind}:#{port}"
|
78
78
|
|
79
79
|
# Set a local site URL in the config if one is not available
|
80
|
-
|
80
|
+
if Bridgetown.env.development? && !options["url"]
|
81
|
+
bt_options.url = bt_bound_url.sub("0.0.0.0", "localhost")
|
82
|
+
end
|
81
83
|
|
82
84
|
Bridgetown::Server.new({
|
83
85
|
Host: bt_options.bind,
|
84
86
|
Port: port,
|
85
|
-
config:
|
87
|
+
config: rack_config_file,
|
86
88
|
}).tap do |server|
|
87
89
|
if server.serveable?
|
88
90
|
pid_tracker.create_pid_dir
|
@@ -115,6 +117,14 @@ module Bridgetown
|
|
115
117
|
end
|
116
118
|
end
|
117
119
|
end
|
120
|
+
|
121
|
+
protected
|
122
|
+
|
123
|
+
def rack_config_file
|
124
|
+
File.exist?("config.ru") ?
|
125
|
+
"config.ru" :
|
126
|
+
File.expand_path("../rack/default_config.ru", __dir__)
|
127
|
+
end
|
118
128
|
end
|
119
129
|
end
|
120
130
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bridgetown
|
4
|
+
# This is for including into Minitest::Expectation
|
5
|
+
module IntuitiveExpectations
|
6
|
+
def true?(msg = nil)
|
7
|
+
must_be(:itself, Minitest::Assertions::UNDEFINED, msg)
|
8
|
+
self
|
9
|
+
end
|
10
|
+
|
11
|
+
def false?(msg = nil)
|
12
|
+
wont_be(:itself, Minitest::Assertions::UNDEFINED, msg)
|
13
|
+
self
|
14
|
+
end
|
15
|
+
|
16
|
+
def ==(other)
|
17
|
+
must_equal(other)
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def !=(other)
|
22
|
+
must_not_equal(other)
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def nil?(msg = nil)
|
27
|
+
must_be_nil(msg)
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
31
|
+
def not_nil?(msg = nil)
|
32
|
+
wont_be_nil(msg)
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
36
|
+
def empty?(msg = nil)
|
37
|
+
must_be_empty(msg)
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def filled?(msg = nil)
|
42
|
+
wont_be_empty(msg)
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def include?(other, msg = nil)
|
47
|
+
must_include(other, msg)
|
48
|
+
self
|
49
|
+
end
|
50
|
+
alias_method :<<, :include?
|
51
|
+
|
52
|
+
def exclude?(other, msg = nil)
|
53
|
+
wont_include(other, msg)
|
54
|
+
self
|
55
|
+
end
|
56
|
+
|
57
|
+
def =~(other)
|
58
|
+
must_match(other)
|
59
|
+
self
|
60
|
+
end
|
61
|
+
|
62
|
+
def is_a?(klass, msg = nil)
|
63
|
+
must_be_instance_of(klass, msg)
|
64
|
+
self
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -10,6 +10,7 @@ class Bridgetown::Site
|
|
10
10
|
@fast_refresh_ordering = 0
|
11
11
|
full_abort = false
|
12
12
|
found_gen_pages = false
|
13
|
+
found_route_file = false
|
13
14
|
paths.each do |path| # rubocop:todo Metrics
|
14
15
|
found_res = resources.select do |resource|
|
15
16
|
resource.id.start_with?("repo://") && in_source_dir(resource.relative_path) == path
|
@@ -28,7 +29,13 @@ class Bridgetown::Site
|
|
28
29
|
self, layout.instance_variable_get(:@base), layout.name
|
29
30
|
)
|
30
31
|
end
|
31
|
-
|
32
|
+
|
33
|
+
if config.key?(:routes) # carve out fast refresh track for the routes plugin
|
34
|
+
found_route_file = config.routes.source_paths.any? do |routes_dir|
|
35
|
+
path.start_with?(in_source_dir(routes_dir))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
next unless found_res.any? || pages.any? || found_route_file
|
32
39
|
|
33
40
|
if pages.any?
|
34
41
|
found_gen_pages = true
|
@@ -48,7 +55,7 @@ class Bridgetown::Site
|
|
48
55
|
end
|
49
56
|
|
50
57
|
marked_resources = resources.select(&:fast_refresh_order).sort_by(&:fast_refresh_order)
|
51
|
-
if full_abort || (marked_resources.empty? && !found_gen_pages)
|
58
|
+
if full_abort || (marked_resources.empty? && !found_gen_pages && !found_route_file)
|
52
59
|
# Darn, a full reload is needed (unless we're on a super-fast track)
|
53
60
|
if reload_if_needed
|
54
61
|
Bridgetown::Hooks.trigger :site, :pre_reload, self, paths
|
@@ -62,13 +69,14 @@ class Bridgetown::Site
|
|
62
69
|
|
63
70
|
Bridgetown::Hooks.trigger :site, :fast_refresh, self
|
64
71
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
72
|
+
unless found_route_file
|
73
|
+
liquid_renderer.reset
|
74
|
+
transform_resources_for_fast_refresh(marked_resources, found_gen_pages)
|
75
|
+
transform_generated_pages_for_fast_refresh
|
76
|
+
end
|
70
77
|
|
71
78
|
Bridgetown::Hooks.trigger :site, :post_write, self
|
79
|
+
Bridgetown.touch_live_reload_file
|
72
80
|
end
|
73
81
|
|
74
82
|
private
|
@@ -28,7 +28,7 @@ class Bridgetown::Site
|
|
28
28
|
|
29
29
|
def enable_ssr
|
30
30
|
Bridgetown.logger.info "SSR:", "enabled."
|
31
|
-
config.fast_refresh = false # SSR mode and Fast Refresh mode are
|
31
|
+
config.fast_refresh = false # SSR mode and Fast Refresh mode are mutually exclusive
|
32
32
|
@ssr_enabled = true
|
33
33
|
end
|
34
34
|
|
@@ -17,6 +17,7 @@ class Bridgetown::Site
|
|
17
17
|
write_redirecting_index if config.prefix_default_locale
|
18
18
|
|
19
19
|
Bridgetown::Hooks.trigger :site, :post_write, self
|
20
|
+
Bridgetown.touch_live_reload_file unless config.disable_disk_cache
|
20
21
|
end
|
21
22
|
|
22
23
|
# Yields all content objects while looping through {#generated_pages},
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bridgetown
|
4
|
+
# This mixin for Bridgetown components allows you to provide front matter and render
|
5
|
+
# the component template via the layouts transformation pipeline, which can be called
|
6
|
+
# from any Roda route
|
7
|
+
module Viewable
|
8
|
+
include Bridgetown::RodaCallable
|
9
|
+
include Bridgetown::Transformable
|
10
|
+
|
11
|
+
def site
|
12
|
+
@site ||= Bridgetown::Current.site
|
13
|
+
end
|
14
|
+
|
15
|
+
def data
|
16
|
+
@data ||= HashWithDotAccess::Hash.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def front_matter(&block)
|
20
|
+
Bridgetown::FrontMatter::RubyFrontMatter.new(data:).tap { _1.instance_exec(&block) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def relative_path = self.class.source_location.delete_prefix("#{site.root_dir}/")
|
24
|
+
|
25
|
+
# Render the component template in the layout specified in your front matter
|
26
|
+
#
|
27
|
+
# @param app [Roda]
|
28
|
+
def render_in_layout(app)
|
29
|
+
render_in(app) => rendered_output
|
30
|
+
|
31
|
+
site.validated_layouts_for(self, data.layout).each do |layout|
|
32
|
+
transform_with_layout(layout, rendered_output, self) => rendered_output
|
33
|
+
end
|
34
|
+
|
35
|
+
rendered_output
|
36
|
+
end
|
37
|
+
|
38
|
+
# Pass a block of front matter and render the component template in layouts
|
39
|
+
#
|
40
|
+
# @param app [Roda]
|
41
|
+
def render_with(app, &)
|
42
|
+
front_matter(&)
|
43
|
+
render_in_layout(app)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -122,14 +122,17 @@ module Bridgetown
|
|
122
122
|
.setup_load_paths!
|
123
123
|
.setup_locales
|
124
124
|
.add_default_collections
|
125
|
-
.
|
125
|
+
.add_destination_paths
|
126
126
|
.check_include_exclude
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
130
|
def run_initializers!(context:) # rubocop:todo Metrics/AbcSize, Metrics/CyclomaticComplexity
|
131
131
|
initializers_file = File.join(root_dir, "config", "initializers.rb")
|
132
|
-
|
132
|
+
unless File.file?(initializers_file)
|
133
|
+
setup_load_paths! appending: true
|
134
|
+
return
|
135
|
+
end
|
133
136
|
|
134
137
|
load initializers_file
|
135
138
|
|
@@ -148,11 +151,15 @@ module Bridgetown
|
|
148
151
|
dsl._run_builtins!
|
149
152
|
self.url = cached_url if cached_url # restore local development URL if need be
|
150
153
|
|
151
|
-
|
154
|
+
setup_post_init!
|
152
155
|
|
153
156
|
self
|
154
157
|
end
|
155
158
|
|
159
|
+
def setup_post_init!
|
160
|
+
add_destination_paths.setup_load_paths! appending: true
|
161
|
+
end
|
162
|
+
|
156
163
|
# @return [Set<SourceManifest>]
|
157
164
|
def source_manifests
|
158
165
|
@source_manifests ||= Set.new
|
@@ -283,13 +290,13 @@ module Bridgetown
|
|
283
290
|
end
|
284
291
|
|
285
292
|
def setup_load_paths!(appending: false) # rubocop:todo Metrics
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
self[:destination] = File.expand_path(self[:destination], self[:root_dir])
|
293
|
+
self[:root_dir] = File.expand_path(self[:root_dir])
|
294
|
+
self[:source] = File.expand_path(self[:source], self[:root_dir])
|
295
|
+
self[:destination] = File.expand_path(self[:destination], self[:root_dir])
|
290
296
|
|
297
|
+
unless appending
|
291
298
|
autoload_paths.unshift({
|
292
|
-
path: self[:plugins_dir],
|
299
|
+
path: File.expand_path(self[:plugins_dir], self[:root_dir]),
|
293
300
|
eager: true,
|
294
301
|
})
|
295
302
|
autoload_paths.unshift({
|
@@ -357,13 +364,18 @@ module Bridgetown
|
|
357
364
|
vendor/bundle/ vendor/cache/ vendor/gems/ vendor/ruby/
|
358
365
|
).freeze
|
359
366
|
|
360
|
-
def
|
367
|
+
def add_destination_paths
|
368
|
+
self["keep_files"] << "_bridgetown" unless
|
369
|
+
self["keep_files"].nil?.! && self["keep_files"].include?("_bridgetown")
|
370
|
+
|
361
371
|
return self if self["exclude"].nil?
|
362
372
|
|
363
373
|
self["exclude"].concat(DEFAULT_EXCLUDES).uniq!
|
364
374
|
self
|
365
375
|
end
|
366
376
|
|
377
|
+
alias_method :add_default_excludes, :add_destination_paths
|
378
|
+
|
367
379
|
def should_execute_inline_ruby?
|
368
380
|
ENV["BRIDGETOWN_RUBY_IN_FRONT_MATTER"] != "false" &&
|
369
381
|
self["ruby_in_front_matter"]
|
@@ -9,7 +9,7 @@ jobs:
|
|
9
9
|
build:
|
10
10
|
runs-on: ubuntu-latest
|
11
11
|
steps:
|
12
|
-
- uses: actions/checkout@
|
12
|
+
- uses: actions/checkout@v4
|
13
13
|
|
14
14
|
- name: Setup Ruby
|
15
15
|
uses: ruby/setup-ruby@v1
|
@@ -17,9 +17,9 @@ jobs:
|
|
17
17
|
bundler-cache: true
|
18
18
|
|
19
19
|
- name: Setup Node
|
20
|
-
uses: actions/setup-node@
|
20
|
+
uses: actions/setup-node@v4
|
21
21
|
with:
|
22
|
-
node-version: "
|
22
|
+
node-version: "22"
|
23
23
|
cache: "npm"
|
24
24
|
- run: npm install
|
25
25
|
|
@@ -29,7 +29,7 @@ jobs:
|
|
29
29
|
run: bin/bridgetown deploy
|
30
30
|
|
31
31
|
- name: Upload build artifact
|
32
|
-
uses: actions/upload-pages-artifact@
|
32
|
+
uses: actions/upload-pages-artifact@v3
|
33
33
|
with:
|
34
34
|
path: ./output
|
35
35
|
|
@@ -48,4 +48,4 @@ jobs:
|
|
48
48
|
steps:
|
49
49
|
- name: Deploy to GitHub Pages
|
50
50
|
id: deployment
|
51
|
-
uses: actions/deploy-pages@
|
51
|
+
uses: actions/deploy-pages@v4
|