pandorga 1.2.3 → 1.2.4
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/CHANGELOG.md +6 -0
- data/lib/pandorga/registry/schema.yml +2 -1
- data/lib/pandorga/registry.rb +7 -2
- data/lib/pandorga/version.rb +1 -1
- data/scripts/test/test-content-backend.rb +50 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 98b663b167e42b55b5f034061a064fcb22cc0612e5583644ee44f1c61557415d
|
|
4
|
+
data.tar.gz: 07cbe585377ae6dac96af92aafc61982405cfa9f7f91ed22ead923a010749f02
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f03e0020239a68af75151157c549d9b6c24a4ad88dd385817be87ca7ffedae4830c29d7ee0f5f0dfec3462971645d25174629ef825dde027b60ed0a45847f499
|
|
7
|
+
data.tar.gz: 3ebd0d3083bc31b0791e212f153ae796919cba639ad8b7ffcc805fdbab974274e53744b8f0bb0f2de7b75e35ecba222fb5e253fa3b9a78bc1e2a39b9409b17ce
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.4] — 2026-10-05
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- An omitted `pandorga.content.backend` keeps a configured `base_url` or legacy `content_api_base_url` as an object-store origin. `static` remains the default only when no public URL is set, and an explicit `backend: static` still wins.
|
|
8
|
+
|
|
3
9
|
## [1.2.3] — 2026-10-05
|
|
4
10
|
|
|
5
11
|
### Changed
|
|
@@ -26,10 +26,11 @@ content:
|
|
|
26
26
|
title: "`pandorga.content`"
|
|
27
27
|
intro: |
|
|
28
28
|
Legacy `content_api_base_url` still works as a fallback for `base_url`.
|
|
29
|
+
When `backend` is omitted, a non-empty `base_url` or `content_api_base_url` selects `object_store`. With no origin, the default is `static`. An explicit `backend: static` still serves JSON from `_site` and clears the public URL at build time.
|
|
29
30
|
keys:
|
|
30
31
|
backend:
|
|
31
32
|
type: "`static` \\| `r2` \\| `object_store` \\| `s3`"
|
|
32
|
-
notes: "`static` serves JSON from `_site`. The others use `base_url` as the public object-store origin"
|
|
33
|
+
notes: "`static` serves JSON from `_site`. The others use `base_url` as the public object-store origin. Omitted plus a public URL selects `object_store`"
|
|
33
34
|
base_url:
|
|
34
35
|
type: string
|
|
35
36
|
notes: Public content origin when backend is not `static`
|
data/lib/pandorga/registry.rb
CHANGED
|
@@ -256,9 +256,14 @@ module PandorgaRegistry
|
|
|
256
256
|
|
|
257
257
|
def content_backend(config)
|
|
258
258
|
raw = config.dig("pandorga", "content", "backend").to_s.strip
|
|
259
|
-
return
|
|
259
|
+
return raw unless raw.empty?
|
|
260
260
|
|
|
261
|
-
|
|
261
|
+
# A public origin is the pre-registry signal that JSON lives on an object
|
|
262
|
+
# store. Static is the default only when no origin is configured; an
|
|
263
|
+
# explicit `backend: static` still wins and the build clears the URL.
|
|
264
|
+
return "object_store" unless content_base_url(config).empty?
|
|
265
|
+
|
|
266
|
+
"static"
|
|
262
267
|
end
|
|
263
268
|
|
|
264
269
|
def content_base_url(config)
|
data/lib/pandorga/version.rb
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# An omitted backend must not discard a configured public origin.
|
|
4
|
+
# Explicit static still serves JSON from _site.
|
|
5
|
+
require "pathname"
|
|
6
|
+
|
|
7
|
+
ROOT = Pathname.new(__dir__).join("../..").expand_path
|
|
8
|
+
$LOAD_PATH.unshift(ROOT.join("lib").to_s)
|
|
9
|
+
require "pandorga/registry"
|
|
10
|
+
|
|
11
|
+
def check!(condition, message)
|
|
12
|
+
return if condition
|
|
13
|
+
|
|
14
|
+
warn "FAIL test-content-backend: #{message}"
|
|
15
|
+
exit 1
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
url = "https://pub-example.r2.dev"
|
|
19
|
+
|
|
20
|
+
check!(PandorgaRegistry.content_backend({}) == "static",
|
|
21
|
+
"no origin must stay static")
|
|
22
|
+
check!(PandorgaRegistry.static_backend?({}),
|
|
23
|
+
"static_backend? must be true when no origin is set")
|
|
24
|
+
|
|
25
|
+
legacy = { "content_api_base_url" => url }
|
|
26
|
+
check!(PandorgaRegistry.content_backend(legacy) == "object_store",
|
|
27
|
+
"legacy content_api_base_url must select object_store, got #{PandorgaRegistry.content_backend(legacy).inspect}")
|
|
28
|
+
check!(PandorgaRegistry.object_store_backend?(legacy),
|
|
29
|
+
"object_store_backend? must be true for a legacy URL")
|
|
30
|
+
check!(PandorgaRegistry.content_base_url(legacy) == url,
|
|
31
|
+
"legacy URL must remain the public origin")
|
|
32
|
+
|
|
33
|
+
base_only = { "pandorga" => { "content" => { "base_url" => "#{url}/" } } }
|
|
34
|
+
check!(PandorgaRegistry.content_backend(base_only) == "object_store",
|
|
35
|
+
"base_url without backend must select object_store")
|
|
36
|
+
check!(PandorgaRegistry.content_base_url(base_only) == url,
|
|
37
|
+
"base_url must be stripped of a trailing slash")
|
|
38
|
+
|
|
39
|
+
explicit_static = {
|
|
40
|
+
"content_api_base_url" => url,
|
|
41
|
+
"pandorga" => { "content" => { "backend" => "static" } }
|
|
42
|
+
}
|
|
43
|
+
check!(PandorgaRegistry.content_backend(explicit_static) == "static",
|
|
44
|
+
"explicit static must win over a leftover URL")
|
|
45
|
+
|
|
46
|
+
explicit_r2 = { "pandorga" => { "content" => { "backend" => "r2", "base_url" => url } } }
|
|
47
|
+
check!(PandorgaRegistry.content_backend(explicit_r2) == "r2",
|
|
48
|
+
"explicit r2 must be preserved")
|
|
49
|
+
|
|
50
|
+
puts "PASS test-content-backend"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pandorga
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Pandorga contributors
|
|
@@ -365,6 +365,7 @@ files:
|
|
|
365
365
|
- scripts/test/test-cdn-pins.rb
|
|
366
366
|
- scripts/test/test-cloudflare-watch-paths-doc.rb
|
|
367
367
|
- scripts/test/test-configuration-doc.rb
|
|
368
|
+
- scripts/test/test-content-backend.rb
|
|
368
369
|
- scripts/test/test-content-detail-urls.rb
|
|
369
370
|
- scripts/test/test-content-keys.rb
|
|
370
371
|
- scripts/test/test-content-license.rb
|