andromeda_cms 0.6.1-x86_64-linux → 0.6.3-x86_64-linux
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 +33 -0
- data/lib/andromeda/assets.rb +15 -0
- data/lib/andromeda/pipeline.rb +2 -0
- data/lib/andromeda/version.rb +1 -1
- data/lib/generators/andromeda/import_astro/content_config_converter.rb +63 -3
- data/lib/generators/andromeda/import_astro/import_astro_generator.rb +7 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 855263206dc24ebe87ce292d2bfd3c9c96d7927ae23eafed8ddb8e7c39cbf601
|
|
4
|
+
data.tar.gz: d1b5dbd227c3406c9f27495be1d11147c4a29b172f05694870494aad5b8aff83
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a81f2ac3c3404fab70619a1b010c2e6819c341b0c04aa29dbc65a4a7ad419129b4a1b28f412947d95747d7ae3973f5859efd830ea7018307281006aa6fe9bb2c
|
|
7
|
+
data.tar.gz: c172675fb835d11c25e5e597fbe7bccd21d7c488ffb214b6386ed38c5e36d53b7a70772a8e005d627fbb5c8140fbb905b27d37c081f6a4538da1ab2f1df9006a
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,37 @@ 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.6.3] - 2026-10-16
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- `andromeda:import_astro` no longer silently mishandles a `glob()` `pattern`
|
|
13
|
+
it cannot carry over. An array pattern is reduced to its first
|
|
14
|
+
non-exclusion element (it used to take the first string, even a `!`
|
|
15
|
+
exclusion), and a note in the report's "Needs a human" section plus a
|
|
16
|
+
`# TODO` above the generated `collection` line name what was lost:
|
|
17
|
+
exclusions that are not applied (those files are still copied and
|
|
18
|
+
loaded) and extra patterns that were dropped (those files are copied but
|
|
19
|
+
not loaded). An extglob pattern such as `!(drafts)/**/*.md`, which Ruby's
|
|
20
|
+
glob cannot match, is flagged the same way instead of leaving the
|
|
21
|
+
collection empty.
|
|
22
|
+
- The gem now requires `tomlrb ~> 2.0`. tomlrb 3.0 removed
|
|
23
|
+
`Tomlrb::Scanner`, which TOML frontmatter parsing uses to report the line
|
|
24
|
+
of a syntax error, so on Ruby 3.3 and later a fresh install picked up 3.0
|
|
25
|
+
and every TOML frontmatter raised `NameError`.
|
|
26
|
+
|
|
27
|
+
## [0.6.2] - 2026-10-09
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- `assets:precompile` no longer leaves out `tailwind.css` when an
|
|
32
|
+
application partial rendered during `andromeda:build` calls `image_tag` or
|
|
33
|
+
`asset_path`. Propshaft caches its file list on the first lookup, so a
|
|
34
|
+
fresh build (an empty `app/assets/builds/`) shipped without the files
|
|
35
|
+
written afterwards and every page raised `Propshaft::MissingAssetError`.
|
|
36
|
+
`andromeda:build` now discards that cache when it finishes, whether or not
|
|
37
|
+
the build succeeds.
|
|
38
|
+
|
|
8
39
|
## [0.6.1] - 2026-10-09
|
|
9
40
|
|
|
10
41
|
### Fixed
|
|
@@ -177,6 +208,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
177
208
|
- Generators: `andromeda:install`, `andromeda:collection`,
|
|
178
209
|
`andromeda:component` and `andromeda:import_astro`.
|
|
179
210
|
|
|
211
|
+
[0.6.3]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.6.3
|
|
212
|
+
[0.6.2]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.6.2
|
|
180
213
|
[0.6.1]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.6.1
|
|
181
214
|
[0.6.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.6.0
|
|
182
215
|
[0.5.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.5.0
|
data/lib/andromeda/assets.rb
CHANGED
|
@@ -95,6 +95,21 @@ module Andromeda
|
|
|
95
95
|
load_path.paths.any? { |directory| File.file?(File.join(directory.to_s, path)) }
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
+
# Discards Propshaft's memoized file list. Propshaft builds it on the first
|
|
99
|
+
# lookup, and app partials rendered during `andromeda:build` can trigger
|
|
100
|
+
# that through `asset_path`. Files written afterwards (tailwind.css from
|
|
101
|
+
# tailwindcss:build, images copied by `publish`) would then be missing from
|
|
102
|
+
# assets:precompile, so the build calls this when it finishes. `clear_cache`
|
|
103
|
+
# is private API; if a Propshaft release renames it, skipping the reset is
|
|
104
|
+
# better than breaking the build.
|
|
105
|
+
def reset_pipeline_cache
|
|
106
|
+
load_path = pipeline_load_path
|
|
107
|
+
return if load_path.nil?
|
|
108
|
+
|
|
109
|
+
load_path.send(:clear_cache) if load_path.respond_to?(:clear_cache, true)
|
|
110
|
+
nil
|
|
111
|
+
end
|
|
112
|
+
|
|
98
113
|
def pipeline_load_path
|
|
99
114
|
return nil unless defined?(::Rails) && ::Rails.respond_to?(:application) && ::Rails.application
|
|
100
115
|
|
data/lib/andromeda/pipeline.rb
CHANGED
data/lib/andromeda/version.rb
CHANGED
|
@@ -18,7 +18,19 @@ module Andromeda
|
|
|
18
18
|
# already makes for MDX import statements. Anything shaped differently
|
|
19
19
|
# falls through to `Attribute#unsupported?` rather than guessing.
|
|
20
20
|
module ContentConfigConverter
|
|
21
|
-
|
|
21
|
+
# `notes` are things about the collection itself (not one field)
|
|
22
|
+
# that still need a human -- e.g. a `pattern` this importer cannot
|
|
23
|
+
# carry over as written. Defaults to empty so existing
|
|
24
|
+
# `Collection.new` calls stay valid.
|
|
25
|
+
Collection = Struct.new(:name, :base, :pattern, :attributes, :notes, keyword_init: true) do
|
|
26
|
+
def initialize(notes: [], **rest) = super(notes: notes, **rest)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
DEFAULT_PATTERN = "**/*.{md,mdx}"
|
|
30
|
+
|
|
31
|
+
# Bash-style extglob openers (`!(drafts)`, `@(a|b)`, ...), which
|
|
32
|
+
# Astro's glob loader accepts but Ruby's `Dir.glob` does not.
|
|
33
|
+
EXTGLOB_RE = /[!@+*?]\(/.freeze
|
|
22
34
|
|
|
23
35
|
# One frontmatter field. `ruby_type` is nil when the Zod expression
|
|
24
36
|
# could not be recognized at all -- `source` (the original
|
|
@@ -65,16 +77,64 @@ module Andromeda
|
|
|
65
77
|
def build_collection(name, body, astro_root:)
|
|
66
78
|
body = BalancedScanner.strip_comments(body)
|
|
67
79
|
base = extract_string(body, /base\s*:/) || "./src/content/#{name}"
|
|
68
|
-
pattern =
|
|
80
|
+
pattern, notes = extract_pattern(body)
|
|
69
81
|
|
|
70
82
|
Collection.new(
|
|
71
83
|
name: name,
|
|
72
84
|
base: File.expand_path(base, astro_root),
|
|
73
85
|
pattern: pattern,
|
|
74
|
-
attributes: extract_attributes(body)
|
|
86
|
+
attributes: extract_attributes(body),
|
|
87
|
+
notes: notes
|
|
75
88
|
)
|
|
76
89
|
end
|
|
77
90
|
|
|
91
|
+
# Astro's `glob({ pattern: ... })` also takes an array (with `!`
|
|
92
|
+
# exclusions) and extglob syntax -- neither of which `Dir.glob`
|
|
93
|
+
# understands. Rather than silently dropping them, the closest
|
|
94
|
+
# usable pattern is kept and a note says what was lost.
|
|
95
|
+
#
|
|
96
|
+
# @return [Array(String, Array<String>)] the pattern and any notes.
|
|
97
|
+
def extract_pattern(body)
|
|
98
|
+
match = /pattern\s*:\s*\[/.match(body)
|
|
99
|
+
return extract_array_pattern(body, match.end(0) - 1) if match
|
|
100
|
+
|
|
101
|
+
pattern = extract_string(body, /pattern\s*:/) || DEFAULT_PATTERN
|
|
102
|
+
return [pattern, []] unless pattern.match?(EXTGLOB_RE)
|
|
103
|
+
|
|
104
|
+
[pattern, ["pattern `#{pattern}` uses extglob syntax, which Ruby's glob does not support -- " \
|
|
105
|
+
"no files will match this pattern"]]
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Only what was actually lost gets a note: `!` exclusions (still
|
|
109
|
+
# copied and loaded) and any further non-exclusion patterns (copied
|
|
110
|
+
# but not loaded). A one-element or empty array loses nothing.
|
|
111
|
+
def extract_array_pattern(body, open_index)
|
|
112
|
+
close = BalancedScanner.matching_close(body, open_index)
|
|
113
|
+
# Squished onto one line: the note also becomes a `# TODO` comment.
|
|
114
|
+
source = body[open_index..close].gsub(/\s+/, " ")
|
|
115
|
+
elements = BalancedScanner.split_top_level(body[(open_index + 1)...close]).map do |literal|
|
|
116
|
+
literal.gsub(/\A(['"`])(.*)\1\z/, '\2')
|
|
117
|
+
end.reject(&:empty?)
|
|
118
|
+
exclusions, includes = elements.partition { |element| element.start_with?("!") }
|
|
119
|
+
pattern = includes.first || DEFAULT_PATTERN
|
|
120
|
+
dropped = includes.drop(1)
|
|
121
|
+
|
|
122
|
+
notes = []
|
|
123
|
+
unless exclusions.empty?
|
|
124
|
+
notes << "exclusions #{backticked(exclusions)} from pattern array #{source} are not applied, " \
|
|
125
|
+
"so the files they exclude are still copied and loaded"
|
|
126
|
+
end
|
|
127
|
+
unless dropped.empty?
|
|
128
|
+
notes << "patterns #{backticked(dropped)} from pattern array #{source} were dropped " \
|
|
129
|
+
"(only `#{pattern}` was kept), so files matching only them are copied but not loaded"
|
|
130
|
+
end
|
|
131
|
+
[pattern, notes]
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def backticked(elements)
|
|
135
|
+
elements.map { |element| "`#{element}`" }.join(", ")
|
|
136
|
+
end
|
|
137
|
+
|
|
78
138
|
# @return [String, nil] the quoted value right after `label_re`, e.g.
|
|
79
139
|
# `base: './src/content/blog'` -> `"./src/content/blog"`.
|
|
80
140
|
def extract_string(body, label_re)
|
|
@@ -80,7 +80,10 @@ module Andromeda
|
|
|
80
80
|
fallback_collections
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
-
@collections.each
|
|
83
|
+
@collections.each do |collection|
|
|
84
|
+
refine_with_json_schema!(collection)
|
|
85
|
+
collection.notes.each { |note| @report[:notes] << "#{collection.name}: #{note}" }
|
|
86
|
+
end
|
|
84
87
|
end
|
|
85
88
|
|
|
86
89
|
# The fallback clause: every top-level directory under
|
|
@@ -231,6 +234,9 @@ module Andromeda
|
|
|
231
234
|
lines = ["# frozen_string_literal: true", ""]
|
|
232
235
|
namespace_modules.each_with_index { |mod, i| lines << "#{" " * i}module #{mod}" }
|
|
233
236
|
lines << "#{indent}class #{collection.name.to_s.singularize.camelize} < Andromeda::Entry"
|
|
237
|
+
collection.notes.each do |note|
|
|
238
|
+
lines << "#{indent} # TODO: #{note} (content.config.ts) -- fix `pattern` by hand."
|
|
239
|
+
end
|
|
234
240
|
lines << "#{indent} collection :#{collection.name}, base: \"app/content/#{collection.name}\", " \
|
|
235
241
|
"pattern: \"#{collection.pattern}\""
|
|
236
242
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: andromeda_cms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.3
|
|
5
5
|
platform: x86_64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- LIMHAUS Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: railties
|
|
@@ -56,14 +56,14 @@ dependencies:
|
|
|
56
56
|
name: tomlrb
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- - "
|
|
59
|
+
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: '2.0'
|
|
62
62
|
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- - "
|
|
66
|
+
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '2.0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|