andromeda_cms 0.4.1 → 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 +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/andromeda/entry.rb +30 -3
- data/lib/andromeda/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3e717009de7bff8e377893a2d94e810d58c3c26827124c63efefdb5e26871df
|
|
4
|
+
data.tar.gz: d7516800193e99d6a1b67ddf781f6703ea56dad3a76e20ed6bc5adbaf1618b33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5062e06b1700c44ebd3adcc4d440d6d929a6f38d593c73491a3d87f7161593e2776b8f9d50fd1ad37b2d6e4c87e15a288bd5d864d5b0961eed113e177c064479
|
|
7
|
+
data.tar.gz: ebf5ff1699e815b80c540f41b897c0977197fa6a7e18089f42f0049800602178e3217f6f651e988b1f49b2b1dbcc16650e0dd904660ebe53ccf29a53e1d56030
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ 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
|
+
|
|
8
18
|
## [0.4.1] - 2026-09-29
|
|
9
19
|
|
|
10
20
|
### Fixed
|
|
@@ -131,6 +141,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
131
141
|
- Generators: `andromeda:install`, `andromeda:collection`,
|
|
132
142
|
`andromeda:component` and `andromeda:import_astro`.
|
|
133
143
|
|
|
144
|
+
[0.4.2]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.2
|
|
134
145
|
[0.4.1]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.1
|
|
135
146
|
[0.4.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.0
|
|
136
147
|
[0.3.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.3.0
|
data/lib/andromeda/entry.rb
CHANGED
|
@@ -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
|
|
178
|
-
#
|
|
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
|
-
|
|
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?
|
data/lib/andromeda/version.rb
CHANGED