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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6564a5382e67a496ec1fb1a08c3bd76601f7fe3e49bfcd7c6950e96c7fec84be
4
- data.tar.gz: 3a57c483bbd9c36e1db0caa694e996ab6b6b9f72c9fb0db248b02bb419307888
3
+ metadata.gz: 98b663b167e42b55b5f034061a064fcb22cc0612e5583644ee44f1c61557415d
4
+ data.tar.gz: 07cbe585377ae6dac96af92aafc61982405cfa9f7f91ed22ead923a010749f02
5
5
  SHA512:
6
- metadata.gz: 38e07ea84144b6fe8812369ee5f0282493ce98cea31454ed8a6a6f072c7275024189524e8e863a3be0307ce55f6dc7bac81d6198f5ae202704df67164d0423fb
7
- data.tar.gz: 36ce18aedcd108d7d247bd050badf62f64d83000b1d0c97dbc7325f7a03bdea8a7dc0ef15ca38fa595222c0e3efe9e4f5c8ba1668e5c831f6ce3558da793b176
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`
@@ -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 "static" if raw.empty?
259
+ return raw unless raw.empty?
260
260
 
261
- raw
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pandorga
4
- VERSION = "1.2.3"
4
+ VERSION = "1.2.4"
5
5
  end
@@ -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.3
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