andromeda_cms 0.8.0 → 0.8.1

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: f5fcf2b6c7dc4e2ae34e6e729b2ce4c7b811c30b5ac1a330a371aa6bcf112114
4
- data.tar.gz: b32192863c7a781f648e9ea4441f91841e21fbc792a33d7df2500df453a124f9
3
+ metadata.gz: 68f8be6ff4cc5e941ef36eee2582fc694d17bdb18549b21a5fe7dc234335e867
4
+ data.tar.gz: 2fddcab6601dd74df216d7dbee5e38c7455f77ff7b1df76937bbfac6dcaabb74
5
5
  SHA512:
6
- metadata.gz: 376cc0430b6244ac65b3c6e112d4ed6e73a12c407af27a1cf3081f1bd352b17a3a7b2e861f6ec0b37f560bc25da5681120e931d20d47a679268eb643b9cea4ca
7
- data.tar.gz: 6d0d3a7fe600e46a22a6165d317ff5186ba7028f5ed3f1fc0de7e13e0d1513580959582898b85b63aa992f86358abf9ff45108c9922562e1cbfd991cc89f4920
6
+ metadata.gz: 351f39fc87b3bf1c13ad5c9c01fb629a35077db5ad78e533632abdb908a49b0e93b9ca958f06f798df4c2a9b35d1d988433ec7bb74dd91c8e15fdce4e8448dca
7
+ data.tar.gz: 63b7df6d40391e076bb5b708481c1eaa042ac9263a3fa1ba27a99c8eafcd157499d204f52d8429ad794a9805bb1885435b2c4846b9ab1cfe81df0d3a6f30168a
data/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.8.1] - 2026-11-21
9
+
10
+ ### Changed
11
+
12
+ - Supports tomlrb 3.0. The `tomlrb` dependency is now `>= 2.0, < 4`
13
+ instead of the `~> 2.0` pin added in 0.6.3, so applications on Ruby 3.3
14
+ or later can move to tomlrb 3.0; Ruby 3.2 keeps resolving to 2.x, which
15
+ stays supported. Syntax errors in TOML (`+++`) frontmatter still report
16
+ the file, line and column. Under tomlrb 3.0, an error that tomlrb reports
17
+ without a position, such as a duplicate key, points at the start of the
18
+ frontmatter.
19
+
8
20
  ## [0.8.0] - 2026-11-14
9
21
 
10
22
  ### Changed
@@ -290,6 +302,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
290
302
  - Generators: `andromeda:install`, `andromeda:collection`,
291
303
  `andromeda:component` and `andromeda:import_astro`.
292
304
 
305
+ [0.8.1]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.8.1
293
306
  [0.8.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.8.0
294
307
  [0.7.1]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.7.1
295
308
  [0.7.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.7.0
@@ -220,13 +220,25 @@ module Andromeda
220
220
  end
221
221
  private_class_method :parse_yaml
222
222
 
223
+ # tomlrb 3.x requires Ruby 3.3+, so Ruby 3.2 still resolves to 2.x. The
224
+ # two majors expose error positions differently (see parse_toml_v2 and
225
+ # parse_toml_v3); Tomlrb::Scanner only exists in 2.x.
223
226
  def parse_toml(text, path:, content_start_line:)
224
227
  return {} if text.strip.empty?
225
228
 
226
- # Not calling the public Tomlrb.parse: it rescues Racc::ParseError
227
- # itself and re-raises as Tomlrb::ParseError carrying only a message,
228
- # which throws away the scanner's position along with it. Driving the
229
- # scanner/parser directly keeps that position reachable below.
229
+ if defined?(Tomlrb::Scanner)
230
+ parse_toml_v2(text, path: path, content_start_line: content_start_line)
231
+ else
232
+ parse_toml_v3(text, path: path, content_start_line: content_start_line)
233
+ end
234
+ end
235
+ private_class_method :parse_toml
236
+
237
+ # tomlrb 2.x. Not calling the public Tomlrb.parse: it rescues
238
+ # Racc::ParseError itself and re-raises as Tomlrb::ParseError carrying
239
+ # only a message, which throws away the scanner's position along with it.
240
+ # Driving the scanner/parser directly keeps that position reachable below.
241
+ def parse_toml_v2(text, path:, content_start_line:)
230
242
  scanner = Tomlrb::Scanner.new(StringIO.new(text))
231
243
  parser = Tomlrb::Parser.new(scanner)
232
244
  normalize_toml_dates(parser.parse.output)
@@ -235,7 +247,31 @@ module Andromeda
235
247
  raise syntax_error(e.message, path: path, content_start_line: content_start_line,
236
248
  relative_line: relative_line, relative_column: relative_column)
237
249
  end
238
- private_class_method :parse_toml
250
+ private_class_method :parse_toml_v2
251
+
252
+ # tomlrb 3.x appends the position to a syntax error's message, 1-based
253
+ # and counting the column in characters.
254
+ TOMLRB_POSITION = /\s+at line (\d+), column (\d+)\z/
255
+
256
+ # tomlrb 3.x. Its hand-written parser no longer uses Racc (so Racc may not
257
+ # be loaded at all) and reports the position only inside the message.
258
+ # Errors without one -- duplicate keys, invalid UTF-8, impossible dates
259
+ # (ArgumentError) -- point at the start of the frontmatter, as the 2.x
260
+ # path does when it can't find a position.
261
+ def parse_toml_v3(text, path:, content_start_line:)
262
+ normalize_toml_dates(Tomlrb.parse(text))
263
+ rescue Tomlrb::ParseError, ArgumentError => e
264
+ message = e.message
265
+ relative_line = relative_column = 0
266
+ if (match = TOMLRB_POSITION.match(message))
267
+ message = match.pre_match
268
+ relative_line = match[1].to_i - 1
269
+ relative_column = match[2].to_i - 1
270
+ end
271
+ raise syntax_error(message, path: path, content_start_line: content_start_line,
272
+ relative_line: relative_line, relative_column: relative_column)
273
+ end
274
+ private_class_method :parse_toml_v3
239
275
 
240
276
  # tomlrb represents TOML's date-only and offset-less-datetime types with
241
277
  # its own Tomlrb::LocalDate/LocalDateTime (only offset datetimes come
@@ -260,7 +296,7 @@ module Andromeda
260
296
  end
261
297
  private_class_method :normalize_toml_dates
262
298
 
263
- # tomlrb's generated (Racc) parser tracks no token-start positions at
299
+ # tomlrb 2.x's generated (Racc) parser tracks no token-start positions at
264
300
  # all, only the underlying StringScanner's current byte offset -- which,
265
301
  # by the time the parser rejects a token, already sits *after* that
266
302
  # token. So the line this resolves to is exact (the offending token is
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Andromeda
4
- VERSION = "0.8.0"
4
+ VERSION = "0.8.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: andromeda_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - LIMHAUS Inc.
@@ -55,16 +55,22 @@ dependencies:
55
55
  name: tomlrb
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '2.0'
61
+ - - "<"
62
+ - !ruby/object:Gem::Version
63
+ version: '4'
61
64
  type: :runtime
62
65
  prerelease: false
63
66
  version_requirements: !ruby/object:Gem::Requirement
64
67
  requirements:
65
- - - "~>"
68
+ - - ">="
66
69
  - !ruby/object:Gem::Version
67
70
  version: '2.0'
71
+ - - "<"
72
+ - !ruby/object:Gem::Version
73
+ version: '4'
68
74
  - !ruby/object:Gem::Dependency
69
75
  name: json
70
76
  requirement: !ruby/object:Gem::Requirement