bridgetown-core 2.0.0.beta3 → 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/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/start.rb +12 -2
- 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/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/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
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Roda
|
4
|
+
module RodaPlugins
|
5
|
+
module Flashier
|
6
|
+
module FlashHashAdditions
|
7
|
+
def info
|
8
|
+
self["info"]
|
9
|
+
end
|
10
|
+
|
11
|
+
def info=(val)
|
12
|
+
self["info"] = val
|
13
|
+
end
|
14
|
+
|
15
|
+
def alert
|
16
|
+
self["alert"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def alert=(val)
|
20
|
+
self["alert"] = val
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module FlashHashIndifferent
|
25
|
+
def []=(key, val)
|
26
|
+
@next[key.to_s] = val
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
module FlashNowHashIndifferent
|
31
|
+
def []=(key, val)
|
32
|
+
super(key.to_s, val)
|
33
|
+
end
|
34
|
+
|
35
|
+
def [](key)
|
36
|
+
super(key.to_s)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.load_dependencies(app)
|
41
|
+
require "roda/plugins/flash"
|
42
|
+
|
43
|
+
Roda::RodaPlugins::Flash::FlashHash.include FlashHashAdditions, FlashHashIndifferent
|
44
|
+
Roda::RodaPlugins::Flash::FlashHash.class_eval do
|
45
|
+
def initialize(hash = {})
|
46
|
+
super(hash || {})
|
47
|
+
now.singleton_class.include FlashHashAdditions, FlashNowHashIndifferent
|
48
|
+
@next = {}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
app.plugin :flash
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
register_plugin :flashier, Flashier
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
+
<title>Bridgetown has loaded</title>
|
7
|
+
<style>
|
8
|
+
html {
|
9
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
10
|
+
}
|
11
|
+
a:link, a:visited {
|
12
|
+
color: rgb(30,40,38);
|
13
|
+
}
|
14
|
+
header {
|
15
|
+
margin-block: 2rem;
|
16
|
+
}
|
17
|
+
main {
|
18
|
+
margin-block: 2rem;
|
19
|
+
margin-inline: auto;
|
20
|
+
max-inline-size: 70ch;
|
21
|
+
}
|
22
|
+
</style>
|
23
|
+
</head>
|
24
|
+
<body>
|
25
|
+
<header style="text-align: center">
|
26
|
+
<svg aria-label="Bridgetown" width="300" viewBox="0 0 1863 572" version="1.1" xmlns="http://www.w3.org/2000/svg" style="display: inline-block; fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
27
|
+
<g transform="matrix(1,0,0,1,-1520.67,-710.833)">
|
28
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
29
|
+
<g transform="matrix(1,0,0,1,374.543,268.081)">
|
30
|
+
<path d="M0,13.784C1.387,13.784 2.283,12.968 2.283,11.664C2.283,10.48 1.387,9.502 0,9.502L-3.629,9.502L-3.629,13.784L0,13.784ZM-0.775,4.404C0.611,4.404 1.591,3.466 1.591,2.12C1.591,0.856 0.611,-0.122 -0.775,-0.122L-3.629,-0.122L-3.629,4.404L-0.775,4.404ZM-9.583,-5.342L0.286,-5.342C4.363,-5.342 7.626,-2.324 7.626,1.508C7.626,3.792 6.687,5.22 4.975,6.524L4.975,6.606C7.504,8.4 8.563,10.114 8.563,12.642C8.563,16.026 5.873,19.126 1.224,19.126L-9.583,19.126L-9.583,-5.342Z" style="fill:rgb(30,40,38);fill-rule:nonzero;"/>
|
31
|
+
</g>
|
32
|
+
</g>
|
33
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
34
|
+
<g transform="matrix(1,0,0,1,404.955,276.605)">
|
35
|
+
<path d="M0,-3.264C1.345,-3.264 2.242,-4.65 2.242,-6.078C2.242,-7.504 1.182,-8.77 -0.165,-8.77L-4.813,-8.77L-4.813,-3.264L0,-3.264ZM-10.808,-13.866L-0.571,-13.866C4.688,-13.866 8.114,-10.686 8.114,-6.078C8.114,-1.796 5.954,0.61 2.323,1.508L8.931,10.602L1.427,10.602L-4.813,1.468L-4.813,10.602L-10.808,10.602L-10.808,-13.866Z" style="fill:rgb(30,40,38);fill-rule:nonzero;"/>
|
36
|
+
</g>
|
37
|
+
</g>
|
38
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
39
|
+
<g transform="matrix(1,0,0,1,0,76.979)">
|
40
|
+
<rect x="424.149" y="185.76" width="5.995" height="24.468" style="fill:rgb(30,40,38);"/>
|
41
|
+
</g>
|
42
|
+
</g>
|
43
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
44
|
+
<g transform="matrix(1,0,0,1,450.609,268.203)">
|
45
|
+
<path d="M0,13.54C3.834,13.54 6.77,10.848 6.77,6.728C6.77,2.936 4.201,-0.04 0,-0.04L-2.406,-0.04L-2.406,13.54L0,13.54ZM-8.401,-5.464L0.123,-5.464C7.341,-5.464 12.928,-0.164 12.928,6.728C12.928,13.254 7.953,19.004 0.123,19.004L-8.401,19.004L-8.401,-5.464Z" style="fill:rgb(30,40,38);fill-rule:nonzero;"/>
|
46
|
+
</g>
|
47
|
+
</g>
|
48
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
49
|
+
<g transform="matrix(1,0,0,1,485.832,288.024)">
|
50
|
+
<path d="M0,-26.101C4.527,-26.101 7.667,-24.429 10.236,-21.819L6.076,-17.985C4.404,-19.495 2.325,-20.433 0,-20.433C-4.364,-20.433 -7.177,-17.171 -7.177,-13.051C-7.177,-8.525 -3.956,-5.668 0.122,-5.668C4.404,-5.668 6.484,-8.035 6.646,-10.401L-0.326,-10.401L-0.326,-15.579L13.132,-15.579L13.132,-13.255C13.132,-6.037 8.89,0 0,0C-7.748,0 -13.254,-5.75 -13.254,-13.051C-13.254,-20.351 -7.748,-26.101 0,-26.101" style="fill:rgb(30,40,38);fill-rule:nonzero;"/>
|
51
|
+
</g>
|
52
|
+
</g>
|
53
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
54
|
+
<g transform="matrix(1,0,0,1,507.961,287.207)">
|
55
|
+
<path d="M0,-24.468L16.191,-24.468L16.191,-19.168L5.995,-19.168L5.995,-14.762L15.417,-14.762L15.417,-9.542L5.995,-9.542L5.995,-5.138L16.64,-5.138L16.64,0L0,0L0,-24.468Z" style="fill:rgb(30,40,38);fill-rule:nonzero;"/>
|
56
|
+
</g>
|
57
|
+
</g>
|
58
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
59
|
+
<g transform="matrix(1,0,0,1,539.963,281.907)">
|
60
|
+
<path d="M0,-13.868L-5.464,-13.868L-5.464,-19.168L11.583,-19.168L11.583,-13.868L6.036,-13.868L6.036,5.3L0,5.3L0,-13.868Z" style="fill:rgb(30,40,38);fill-rule:nonzero;"/>
|
61
|
+
</g>
|
62
|
+
</g>
|
63
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
64
|
+
<g transform="matrix(1,0,0,1,574.253,267.591)">
|
65
|
+
<path d="M0,14.765C4.322,14.765 7.095,11.5 7.095,7.383C7.095,3.263 4.322,0 0,0C-4.364,0 -7.096,3.263 -7.096,7.383C-7.096,11.5 -4.364,14.765 0,14.765M0,-5.668C7.707,-5.668 13.172,0.082 13.172,7.383C13.172,14.683 7.707,20.433 0,20.433C-7.749,20.433 -13.173,14.683 -13.173,7.383C-13.173,0.082 -7.749,-5.668 0,-5.668" style="fill:rgb(30,40,38);fill-rule:nonzero;"/>
|
66
|
+
</g>
|
67
|
+
</g>
|
68
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
69
|
+
<g transform="matrix(1,0,0,1,595.415,288.023)">
|
70
|
+
<path d="M0,-25.284L6.28,-25.284L11.216,-13.744L14.192,-21.41L15.683,-25.284L18.842,-25.284L20.489,-21.412L23.735,-13.784L28.221,-25.284L34.461,-25.284L24.266,0L23.449,0L17.413,-14.11L11.583,0L10.808,0L0,-25.284Z" style="fill:rgb(30,40,38);fill-rule:nonzero;"/>
|
71
|
+
</g>
|
72
|
+
</g>
|
73
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
74
|
+
<g transform="matrix(1,0,0,1,639.899,287.207)">
|
75
|
+
<path d="M0,-24.468L6.322,-24.468L15.825,-9.95L15.825,-24.468L21.779,-24.468L21.779,0L15.539,0L5.995,-14.558L5.995,0L0,0L0,-24.468Z" style="fill:rgb(30,40,38);fill-rule:nonzero;"/>
|
76
|
+
</g>
|
77
|
+
</g>
|
78
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
79
|
+
<g transform="matrix(1,0,0,1,724.324,209.37)">
|
80
|
+
<path d="M0,29.41C-72.335,-66.167 -179.131,-55.549 -222.588,25.781C-227.373,34.738 -221.818,40.631 -219.109,39.985C-214.298,38.838 -197.926,32.314 -192.966,30.318C-190.894,29.485 -189.207,25.502 -187.375,21.877C-150.071,-51.956 -100.392,-60.124 -29.16,95.577C-32.607,77.837 -25.455,57.889 -2.274,37.237C0.394,34.86 2.589,32.831 0,29.41" style="fill:rgb(58,109,98);fill-rule:nonzero;"/>
|
81
|
+
</g>
|
82
|
+
</g>
|
83
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
84
|
+
<g transform="matrix(0.249711,-0.96832,-0.96832,-0.249711,486.176,197.302)">
|
85
|
+
<path d="M-12.21,-30.272C-28.365,-22.83 -44.336,-18.635 -46.819,-29.09C-48.223,-18.969 -9.68,-0.335 -12.21,21.62C-12.329,22.654 -10.713,22.914 -10.274,21.97C-1.487,3.05 -6.95,-23.042 -12.21,-30.272" style="fill:rgb(58,109,98);fill-rule:nonzero;"/>
|
86
|
+
</g>
|
87
|
+
</g>
|
88
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
89
|
+
<g transform="matrix(1,0,0,1,810.402,309.68)">
|
90
|
+
<path d="M0,-88.196C1.54,-88.196 2.104,-85.899 0.603,-85.55C-30.253,-78.37 -43.813,-48.307 -44.559,-31.561C-44.807,-26.006 -49.573,-25.025 -55.084,-22.473C-61.232,-19.625 -90.024,-7.312 -100.946,-3.404C-106.293,-1.49 -114.206,0.003 -114.576,-8.251C-116.052,-41.137 -81.521,-88.199 0,-88.196" style="fill:rgb(58,109,98);fill-rule:nonzero;"/>
|
91
|
+
</g>
|
92
|
+
</g>
|
93
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
94
|
+
<g transform="matrix(-126.776,-126.776,-126.776,126.776,684.306,302.422)">
|
95
|
+
<path d="M0.982,0.451C0.969,0.497 0.927,0.51 0.915,0.489C0.908,0.475 0.904,0.461 0.922,0.407C1.064,-0.03 0.945,-0.409 -0,-0.064C0.038,-0.102 0.068,-0.161 0.081,-0.234C0.45,-0.351 0.717,-0.297 0.868,-0.146C1.006,-0.008 1.047,0.21 0.982,0.451Z" style="fill:url(#_Linear1);fill-rule:nonzero;"/>
|
96
|
+
</g>
|
97
|
+
</g>
|
98
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
99
|
+
<g transform="matrix(0,-49.0052,-49.0052,0,756.207,273.884)">
|
100
|
+
<path d="M1,-0.813C0.989,-0.345 0.777,0.495 0.044,0.821C0.016,0.833 -0.014,0.798 0.007,0.775C0.271,0.479 0.447,0.027 0.429,-0.27C0.429,-0.28 0.427,-0.288 0.436,-0.292C0.61,-0.373 0.828,-0.554 0.969,-0.821C0.977,-0.837 1,-0.831 1,-0.814L1,-0.813Z" style="fill:url(#_Linear2);fill-rule:nonzero;"/>
|
101
|
+
</g>
|
102
|
+
</g>
|
103
|
+
<g transform="matrix(4.16667,0,0,4.16667,0,0)">
|
104
|
+
<g transform="matrix(30.5248,-8.50108,-8.50108,-30.5248,478.044,231.713)">
|
105
|
+
<path d="M0.489,-0.516C0.521,-0.344 0.815,-0.062 1.05,0.111C0.884,0.153 0.635,0.169 0.489,0.081C0.474,0.152 0.308,0.424 0.152,0.616C0.317,0.306 0.438,-0.424 0.489,-0.516Z" style="fill:url(#_Linear3);fill-rule:nonzero;"/>
|
106
|
+
</g>
|
107
|
+
</g>
|
108
|
+
</g>
|
109
|
+
<defs>
|
110
|
+
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,-1,0,0.100447)"><stop offset="0" style="stop-color:rgb(58,109,98);stop-opacity:1"/><stop offset="0.95" style="stop-color:rgb(44,73,73);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(44,73,73);stop-opacity:1"/></linearGradient>
|
111
|
+
<linearGradient id="_Linear2" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,-1,0,-0.00347458)"><stop offset="0" style="stop-color:rgb(58,109,98);stop-opacity:1"/><stop offset="0.95" style="stop-color:rgb(44,73,73);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(44,73,73);stop-opacity:1"/></linearGradient>
|
112
|
+
<linearGradient id="_Linear3" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.268287,-0.963339,-0.963339,0.268287,0.634136,0.481664)"><stop offset="0" style="stop-color:rgb(58,109,98);stop-opacity:1"/><stop offset="0.95" style="stop-color:rgb(44,73,73);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(44,73,73);stop-opacity:1"/></linearGradient>
|
113
|
+
</defs>
|
114
|
+
</svg>
|
115
|
+
<h1>The server has booted successfully.</h1>
|
116
|
+
</header>
|
117
|
+
|
118
|
+
<main>
|
119
|
+
<p>However, it seems like the <code>index</code> file is missing from your source folder.</p>
|
120
|
+
|
121
|
+
<p>If you add a file like <code>index.erb</code> or <code>index.md</code> to your source folder,
|
122
|
+
you'll be able to see that instead of this generic message.</p>
|
123
|
+
|
124
|
+
<p>Still stuck? <a href="https://www.bridgetownrb.com/community">Our developer community may be able to lend you a hand</a>. Good luck!</p>
|
125
|
+
</main>
|
126
|
+
</body>
|
127
|
+
</html>
|
data/lib/roda/plugins/ssg.rb
CHANGED
@@ -5,7 +5,7 @@ require "rack/files"
|
|
5
5
|
|
6
6
|
class Roda
|
7
7
|
module RodaPlugins
|
8
|
-
# This is a
|
8
|
+
# This is a simplified and modified variant of Roda's Public core plugin. It adds additional
|
9
9
|
# functionality so that you can host an entire static site through Roda. What's necessary for
|
10
10
|
# this to work is handling "pretty" URLs, aka:
|
11
11
|
#
|
@@ -29,6 +29,7 @@ class Roda
|
|
29
29
|
path = PARSER.unescape(real_remaining_path)
|
30
30
|
return if path.include?("\0")
|
31
31
|
|
32
|
+
# @type [Rack::Files]
|
32
33
|
server = roda_class.opts[:ssg_server]
|
33
34
|
path = File.join(server.root, *segments_for_path(path))
|
34
35
|
|
@@ -40,7 +41,7 @@ class Roda
|
|
40
41
|
halt [status, response_headers, body]
|
41
42
|
end
|
42
43
|
|
43
|
-
# TODO: this could be refactored a bit
|
44
|
+
# TODO: this could be refactored a bit for clarity
|
44
45
|
def segments_for_path(path) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
45
46
|
segments = []
|
46
47
|
|
@@ -68,6 +68,8 @@ Bridgetown.configure do |config|
|
|
68
68
|
#
|
69
69
|
# init :ssr
|
70
70
|
#
|
71
|
+
# Add `sessions: true` if you need to use session data, flash, etc.
|
72
|
+
#
|
71
73
|
|
72
74
|
# Uncomment to use file-based dynamic template routing via Roda (make sure you
|
73
75
|
# uncomment the gem dependency in your `Gemfile` as well):
|
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
|
@@ -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
|