andromeda_cms 0.4.0 → 0.4.2

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: 2702633c9baaedc1b40c9a7bf767fe41dd472276bd1f279cabcea893746b9924
4
- data.tar.gz: 6c4c0463b1709aa434a11ce3700f67a4b2d573237353cef8f2ed87e034b8b742
3
+ metadata.gz: b3e717009de7bff8e377893a2d94e810d58c3c26827124c63efefdb5e26871df
4
+ data.tar.gz: d7516800193e99d6a1b67ddf781f6703ea56dad3a76e20ed6bc5adbaf1618b33
5
5
  SHA512:
6
- metadata.gz: a6dae30e5bcd69aeb8665d1991be26ec0705471d8fe592c703f0824441adfa0b40dd69de95b6480616fe49348aebc6127ba2051611dc19156f62ea66192b396e
7
- data.tar.gz: 856b571be0856f01afe55c14661e5ac9f49eb1b67b7329e712ebc077fa413a2b961a95832ee38374fa768b688779cbbc4ce705ab3bddccc9008d7cab0374b41a
6
+ metadata.gz: 5062e06b1700c44ebd3adcc4d440d6d929a6f38d593c73491a3d87f7161593e2776b8f9d50fd1ad37b2d6e4c87e15a288bd5d864d5b0961eed113e177c064479
7
+ data.tar.gz: ebf5ff1699e815b80c540f41b897c0977197fa6a7e18089f42f0049800602178e3217f6f651e988b1f49b2b1dbcc16650e0dd904660ebe53ccf29a53e1d56030
data/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ 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.4.2] - 2026-09-30
9
+
10
+ ### Fixed
11
+
12
+ - In development, a file added or edited under `app/content/` now shows up
13
+ without restarting the server. `Entry` used to keep the list it loaded
14
+ first, so a new file returned 404 and an edited one kept its old content.
15
+ The list is now reloaded when the paths, mtimes or sizes of the collection's
16
+ source files change; production is unchanged.
17
+
18
+ ## [0.4.1] - 2026-09-29
19
+
20
+ ### Fixed
21
+
22
+ - `image_tag andromeda_image_url(src)` in a component no longer fails
23
+ `andromeda:build` with `Propshaft::MissingAssetError`. While converting,
24
+ the asset helpers (`image_tag`, `asset_path`, `asset_url`...) pass an asset
25
+ marker through untouched, so `andromeda_content` resolves it when the page
26
+ is served.
27
+
8
28
  ## [0.4.0] - 2026-09-29
9
29
 
10
30
  ### Added
@@ -121,6 +141,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
121
141
  - Generators: `andromeda:install`, `andromeda:collection`,
122
142
  `andromeda:component` and `andromeda:import_astro`.
123
143
 
144
+ [0.4.2]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.2
145
+ [0.4.1]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.1
124
146
  [0.4.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.0
125
147
  [0.3.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.3.0
126
148
  [0.2.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.2.0
data/README.md CHANGED
@@ -234,6 +234,9 @@ The partial receives the same `Andromeda::Image` an `image` attribute holds:
234
234
  </figure>
235
235
  ```
236
236
 
237
+ `image_tag andromeda_image_url(src)` works as well: while converting, the
238
+ asset helpers pass the placeholder through untouched.
239
+
237
240
  ## Development and deployment
238
241
 
239
242
  ```
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "digest"
3
4
  require "pathname"
4
5
 
5
6
  module Andromeda
@@ -45,6 +46,7 @@ module Andromeda
45
46
  @base_dir = resolve_base(base)
46
47
  @pattern = pattern
47
48
  @entries = nil
49
+ @entries_signature = nil
48
50
  Andromeda::Registry.register(@collection_name, self)
49
51
  self
50
52
  end
@@ -174,10 +176,12 @@ module Andromeda
174
176
  end
175
177
 
176
178
  # Drops the in-memory cache, forcing the next query to re-run the
177
- # Loader. Used by tests that change fixtures mid-example, and is the
178
- # hook the dev-mode "reconvert on stale mtime" check will call.
179
+ # Loader. Used by tests that change fixtures mid-example and by
180
+ # Andromeda::Check; development queries notice source changes on their
181
+ # own (see `entries`).
179
182
  def reload!
180
183
  @entries = nil
184
+ @entries_signature = nil
181
185
  end
182
186
 
183
187
  private
@@ -190,10 +194,33 @@ module Andromeda
190
194
  # the index is only rewritten once a collection finishes converting,
191
195
  # so a component querying entries mid-build reads source instead
192
196
  # (see Andromeda::BuildContext).
197
+ #
198
+ # The development cache is dropped whenever the source files change
199
+ # (see `source_signature`), so a file added or edited while the server
200
+ # runs shows up on the next query without a restart.
193
201
  def entries
194
202
  return source_entries if Andromeda::BuildContext.building?
203
+ return @entries ||= entries_from_index if production?
204
+
205
+ signature = source_signature
206
+ if @entries.nil? || signature != @entries_signature
207
+ @entries = load_entries_from_source
208
+ @entries_signature = signature
209
+ end
210
+ @entries
211
+ end
212
+
213
+ # Paths, mtimes and sizes of the collection's source files: an added or
214
+ # removed file changes the path list, an edit changes mtime/size. Same
215
+ # scheme as Andromeda::Pipeline#render_key uses for component partials.
216
+ def source_signature
217
+ files = Dir.glob(pattern, base: base_dir).sort.filter_map do |relative|
218
+ file = File.join(base_dir, relative)
219
+ next unless File.file?(file)
195
220
 
196
- @entries ||= production? ? entries_from_index : load_entries_from_source
221
+ [relative, File.mtime(file).to_r, File.size(file)].join(":")
222
+ end
223
+ Digest::SHA256.hexdigest(files.join("\n"))
197
224
  end
198
225
 
199
226
  def production?
@@ -32,6 +32,23 @@ module Andromeda
32
32
  Andromeda::BuildContext.converting? ? source : Andromeda::Assets.resolve(source)
33
33
  end
34
34
 
35
+ # Lets `image_tag andromeda_image_url(src)` work at conversion time.
36
+ # The marker has no `//`, so Rails would take it for a logical path and
37
+ # Propshaft would fail to find it; passing it through leaves it for
38
+ # `andromeda_content` to resolve like any other marker. Every asset
39
+ # helper (`image_tag`, `image_path`, `asset_url`...) goes through here.
40
+ def asset_path(source, options = {})
41
+ return source if Andromeda::BuildContext.converting? && source.to_s.start_with?(Andromeda::Assets::MARKER)
42
+
43
+ super
44
+ end
45
+
46
+ # `image_tag` and `asset_url` call this alias, which Rails binds to its
47
+ # own `asset_path` and so would skip the override above.
48
+ def path_to_asset(source, options = {})
49
+ asset_path(source, options)
50
+ end
51
+
35
52
  # Renders a nested table of contents from `entry.headings`.
36
53
  #
37
54
  # `min`/`max` default to h2..h3 because a page's h1 is usually the entry
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Andromeda
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.2"
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.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - LIMHAUS Inc.