bridgetown-core 2.0.0.beta2 → 2.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/bridgetown-core.gemspec +43 -42
- data/lib/bridgetown-core/cache.rb +3 -19
- data/lib/bridgetown-core/cleaner.rb +17 -19
- data/lib/bridgetown-core/collection.rb +6 -5
- data/lib/bridgetown-core/commands/base.rb +7 -0
- data/lib/bridgetown-core/commands/build.rb +35 -22
- data/lib/bridgetown-core/commands/concerns/actions.rb +4 -0
- data/lib/bridgetown-core/commands/console.rb +0 -1
- data/lib/bridgetown-core/commands/esbuild/esbuild.config.js +7 -6
- data/lib/bridgetown-core/commands/esbuild/esbuild.defaults.js.erb +14 -13
- data/lib/bridgetown-core/commands/esbuild/migrate-from-webpack.rb +1 -1
- data/lib/bridgetown-core/commands/esbuild/update.rb +17 -3
- data/lib/bridgetown-core/commands/esbuild.rb +1 -1
- 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/layout_placeable.rb +1 -1
- data/lib/bridgetown-core/concerns/publishable.rb +2 -0
- data/lib/bridgetown-core/concerns/site/content.rb +4 -1
- data/lib/bridgetown-core/concerns/site/extensible.rb +6 -1
- data/lib/bridgetown-core/concerns/site/fast_refreshable.rb +33 -18
- data/lib/bridgetown-core/concerns/site/localizable.rb +2 -0
- data/lib/bridgetown-core/concerns/site/processable.rb +2 -0
- data/lib/bridgetown-core/concerns/site/renderable.rb +3 -0
- data/lib/bridgetown-core/concerns/site/ssr.rb +1 -2
- 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 +29 -23
- 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/converter.rb +2 -7
- data/lib/bridgetown-core/converters/erb_templates.rb +11 -7
- data/lib/bridgetown-core/converters/identity.rb +3 -11
- data/lib/bridgetown-core/converters/liquid_templates.rb +3 -5
- data/lib/bridgetown-core/converters/markdown/kramdown_parser.rb +1 -1
- data/lib/bridgetown-core/converters/markdown.rb +11 -14
- data/lib/bridgetown-core/converters/serbea_templates.rb +10 -8
- data/lib/bridgetown-core/drops/drop.rb +29 -42
- data/lib/bridgetown-core/drops/resource_drop.rb +3 -12
- data/lib/bridgetown-core/errors.rb +2 -8
- data/lib/bridgetown-core/filters/condition_helpers.rb +6 -9
- data/lib/bridgetown-core/filters/date_filters.rb +22 -35
- data/lib/bridgetown-core/filters/grouping_filters.rb +11 -11
- data/lib/bridgetown-core/filters.rb +53 -72
- data/lib/bridgetown-core/front_matter/defaults.rb +14 -19
- data/lib/bridgetown-core/generated_page.rb +6 -6
- data/lib/bridgetown-core/generators/prototype_generator.rb +0 -2
- data/lib/bridgetown-core/helpers.rb +2 -2
- data/lib/bridgetown-core/hooks.rb +0 -1
- data/lib/bridgetown-core/layout.rb +3 -4
- data/lib/bridgetown-core/liquid_extensions.rb +3 -5
- data/lib/bridgetown-core/log_adapter.rb +37 -56
- data/lib/bridgetown-core/plugin_manager.rb +7 -3
- 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/logger.rb +0 -2
- data/lib/bridgetown-core/rack/routes.rb +3 -2
- data/lib/bridgetown-core/resource/base.rb +8 -8
- data/lib/bridgetown-core/resource/permalink_processor.rb +1 -1
- data/lib/bridgetown-core/resource/relations.rb +3 -1
- data/lib/bridgetown-core/ruby_template_view.rb +0 -1
- data/lib/bridgetown-core/static_file.rb +15 -20
- data/lib/bridgetown-core/tags/class_map.rb +1 -1
- data/lib/bridgetown-core/tags/post_url.rb +2 -32
- data/lib/bridgetown-core/utils/initializers.rb +2 -2
- data/lib/bridgetown-core/utils/require_gems.rb +1 -3
- data/lib/bridgetown-core/utils.rb +41 -44
- data/lib/bridgetown-core/watcher.rb +2 -3
- data/lib/bridgetown-core.rb +29 -10
- data/lib/roda/plugins/bridgetown_server.rb +13 -25
- 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
- data/lib/site_template/package.json.erb +1 -0
- data/lib/site_template/postcss.config.js.erb +1 -1
- metadata +26 -7
- data/lib/bridgetown-core/commands/doctor.rb +0 -147
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridgetown-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - '='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 2.0.0.
|
67
|
+
version: 2.0.0.beta4
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - '='
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 2.0.0.
|
74
|
+
version: 2.0.0.beta4
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: csv
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +156,20 @@ dependencies:
|
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '1.0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: irb
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '1.14'
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '1.14'
|
159
173
|
- !ruby/object:Gem::Dependency
|
160
174
|
name: kramdown
|
161
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -328,14 +342,14 @@ dependencies:
|
|
328
342
|
requirements:
|
329
343
|
- - ">="
|
330
344
|
- !ruby/object:Gem::Version
|
331
|
-
version: 0.
|
345
|
+
version: 0.6.0
|
332
346
|
type: :runtime
|
333
347
|
prerelease: false
|
334
348
|
version_requirements: !ruby/object:Gem::Requirement
|
335
349
|
requirements:
|
336
350
|
- - ">="
|
337
351
|
- !ruby/object:Gem::Version
|
338
|
-
version: 0.
|
352
|
+
version: 0.6.0
|
339
353
|
- !ruby/object:Gem::Dependency
|
340
354
|
name: thor
|
341
355
|
requirement: !ruby/object:Gem::Requirement
|
@@ -408,7 +422,6 @@ files:
|
|
408
422
|
- lib/bridgetown-core/commands/concerns/summarizable.rb
|
409
423
|
- lib/bridgetown-core/commands/configure.rb
|
410
424
|
- lib/bridgetown-core/commands/console.rb
|
411
|
-
- lib/bridgetown-core/commands/doctor.rb
|
412
425
|
- lib/bridgetown-core/commands/esbuild.rb
|
413
426
|
- lib/bridgetown-core/commands/esbuild/esbuild.config.js
|
414
427
|
- lib/bridgetown-core/commands/esbuild/esbuild.defaults.js.erb
|
@@ -421,6 +434,7 @@ files:
|
|
421
434
|
- lib/bridgetown-core/commands/registrations.rb
|
422
435
|
- lib/bridgetown-core/commands/start.rb
|
423
436
|
- lib/bridgetown-core/component.rb
|
437
|
+
- lib/bridgetown-core/concerns/intuitive_expectations.rb
|
424
438
|
- lib/bridgetown-core/concerns/layout_placeable.rb
|
425
439
|
- lib/bridgetown-core/concerns/localizable.rb
|
426
440
|
- lib/bridgetown-core/concerns/prioritizable.rb
|
@@ -435,6 +449,7 @@ files:
|
|
435
449
|
- lib/bridgetown-core/concerns/site/ssr.rb
|
436
450
|
- lib/bridgetown-core/concerns/site/writable.rb
|
437
451
|
- lib/bridgetown-core/concerns/transformable.rb
|
452
|
+
- lib/bridgetown-core/concerns/viewable.rb
|
438
453
|
- lib/bridgetown-core/configuration.rb
|
439
454
|
- lib/bridgetown-core/configuration/configuration_dsl.rb
|
440
455
|
- lib/bridgetown-core/configurations/.keep
|
@@ -536,6 +551,8 @@ files:
|
|
536
551
|
- lib/bridgetown-core/plugin.rb
|
537
552
|
- lib/bridgetown-core/plugin_manager.rb
|
538
553
|
- lib/bridgetown-core/rack/boot.rb
|
554
|
+
- lib/bridgetown-core/rack/default_config.ru
|
555
|
+
- lib/bridgetown-core/rack/loader_hooks.rb
|
539
556
|
- lib/bridgetown-core/rack/logger.rb
|
540
557
|
- lib/bridgetown-core/rack/routes.rb
|
541
558
|
- lib/bridgetown-core/reader.rb
|
@@ -578,6 +595,8 @@ files:
|
|
578
595
|
- lib/bridgetown-core/yaml_parser.rb
|
579
596
|
- lib/roda/plugins/bridgetown_server.rb
|
580
597
|
- lib/roda/plugins/bridgetown_ssr.rb
|
598
|
+
- lib/roda/plugins/flashier.rb
|
599
|
+
- lib/roda/plugins/generic_index.html
|
581
600
|
- lib/roda/plugins/initializers.rb
|
582
601
|
- lib/roda/plugins/method_override.rb
|
583
602
|
- lib/roda/plugins/ssg.rb
|
@@ -1,147 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Bridgetown
|
4
|
-
module Commands
|
5
|
-
class Doctor < Thor::Group
|
6
|
-
extend BuildOptions
|
7
|
-
extend Summarizable
|
8
|
-
include ConfigurationOverridable
|
9
|
-
|
10
|
-
Registrations.register do
|
11
|
-
register(Doctor, "doctor", "doctor", Doctor.summary)
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.banner
|
15
|
-
"bridgetown doctor [options]"
|
16
|
-
end
|
17
|
-
summary "Search site and print specific deprecation warnings"
|
18
|
-
|
19
|
-
def doctor
|
20
|
-
site = Bridgetown::Site.new(configuration_with_overrides(options))
|
21
|
-
site.reset
|
22
|
-
site.read
|
23
|
-
site.generate
|
24
|
-
|
25
|
-
if healthy?(site)
|
26
|
-
Bridgetown.logger.info "Your test results", "are in. Everything looks fine."
|
27
|
-
else
|
28
|
-
abort
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
protected
|
33
|
-
|
34
|
-
def healthy?(site)
|
35
|
-
[
|
36
|
-
!conflicting_urls(site),
|
37
|
-
!urls_only_differ_by_case(site),
|
38
|
-
proper_site_url?(site),
|
39
|
-
properly_gathered_posts?(site),
|
40
|
-
].all?
|
41
|
-
end
|
42
|
-
|
43
|
-
def properly_gathered_posts?(site)
|
44
|
-
return true if site.config["collections_dir"].empty?
|
45
|
-
|
46
|
-
posts_at_root = site.in_source_dir("_posts")
|
47
|
-
return true unless File.directory?(posts_at_root)
|
48
|
-
|
49
|
-
Bridgetown.logger.warn "Warning:",
|
50
|
-
"Detected '_posts' directory outside custom `collections_dir`!"
|
51
|
-
Bridgetown.logger.warn "",
|
52
|
-
"Please move '#{posts_at_root}' into the custom directory at " \
|
53
|
-
"'#{site.in_source_dir(site.config["collections_dir"])}'"
|
54
|
-
false
|
55
|
-
end
|
56
|
-
|
57
|
-
def conflicting_urls(site)
|
58
|
-
conflicting_urls = false
|
59
|
-
urls = {}
|
60
|
-
urls = collect_urls(urls, site.contents, site.dest)
|
61
|
-
urls.each do |url, paths|
|
62
|
-
next unless paths.size > 1
|
63
|
-
|
64
|
-
conflicting_urls = true
|
65
|
-
Bridgetown.logger.warn "Conflict:", "The URL '#{url}' is the destination " \
|
66
|
-
"for the following pages: #{paths.join(", ")}"
|
67
|
-
end
|
68
|
-
conflicting_urls
|
69
|
-
end
|
70
|
-
|
71
|
-
def urls_only_differ_by_case(site)
|
72
|
-
urls_only_differ_by_case = false
|
73
|
-
urls = case_insensitive_urls(site.resources, site.dest)
|
74
|
-
urls.each_value do |real_urls|
|
75
|
-
next unless real_urls.uniq.size > 1
|
76
|
-
|
77
|
-
urls_only_differ_by_case = true
|
78
|
-
Bridgetown.logger.warn(
|
79
|
-
"Warning:",
|
80
|
-
"The following URLs only differ by case. On a case-insensitive file system one of " \
|
81
|
-
"the URLs will be overwritten by the other: #{real_urls.join(", ")}"
|
82
|
-
)
|
83
|
-
end
|
84
|
-
urls_only_differ_by_case
|
85
|
-
end
|
86
|
-
|
87
|
-
def proper_site_url?(site)
|
88
|
-
url = site.config["url"]
|
89
|
-
[
|
90
|
-
url_exists?(url),
|
91
|
-
url_valid?(url),
|
92
|
-
url_absolute(url),
|
93
|
-
].all?
|
94
|
-
end
|
95
|
-
|
96
|
-
private
|
97
|
-
|
98
|
-
def collect_urls(urls, things, destination)
|
99
|
-
things.each do |thing|
|
100
|
-
dest = thing.method(:destination).arity == 1 ?
|
101
|
-
thing.destination(destination) :
|
102
|
-
thing.destination
|
103
|
-
if urls[dest]
|
104
|
-
urls[dest] << thing.path
|
105
|
-
else
|
106
|
-
urls[dest] = [thing.path]
|
107
|
-
end
|
108
|
-
end
|
109
|
-
urls
|
110
|
-
end
|
111
|
-
|
112
|
-
def case_insensitive_urls(things, _destination)
|
113
|
-
things.each_with_object({}) do |thing, memo|
|
114
|
-
dest = thing.destination&.output_path
|
115
|
-
(memo[dest.downcase] ||= []) << dest if dest
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def url_exists?(url)
|
120
|
-
return true unless url.nil? || url.empty?
|
121
|
-
|
122
|
-
Bridgetown.logger.warn "Warning:", "You didn't set an URL in the config file, " \
|
123
|
-
"you may encounter problems with some plugins."
|
124
|
-
false
|
125
|
-
end
|
126
|
-
|
127
|
-
def url_valid?(url)
|
128
|
-
Addressable::URI.parse(url)
|
129
|
-
true
|
130
|
-
# Addressable::URI#parse only raises a TypeError
|
131
|
-
# https://git.io/vFfbx
|
132
|
-
rescue TypeError
|
133
|
-
Bridgetown.logger.warn "Warning:", "The site URL does not seem to be valid, " \
|
134
|
-
"check the value of `url` in your config file."
|
135
|
-
false
|
136
|
-
end
|
137
|
-
|
138
|
-
def url_absolute(url)
|
139
|
-
return true if url.is_a?(String) && Addressable::URI.parse(url).absolute?
|
140
|
-
|
141
|
-
Bridgetown.logger.warn "Warning:", "Your site URL does not seem to be absolute, " \
|
142
|
-
"check the value of `url` in your config file."
|
143
|
-
false
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|