andromeda_cms 0.5.0-x86_64-linux → 0.6.1-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03ab78f438713d8cd183ac96f3793c2c2edbbb333d34946194019f3995703209
4
- data.tar.gz: 772700733a8ff9222a5d84383015894eaab3f77311d292fbf827825dbac688f4
3
+ metadata.gz: acf53f64d37175f87d3e0333cd95a31cd861d3b449701914f00d3dbd00afd44f
4
+ data.tar.gz: e0358f652240a474ff2abb3a84929e92fe958e81c514f39ce4292102b6b17526
5
5
  SHA512:
6
- metadata.gz: d4b27eda0bf028f490e1672aa98cc3b15aa1ef3dc7d484212b1182595dc3900125786932f27e5cdc5f0f819e356f50905c7a991857e59d08457e00064165d499
7
- data.tar.gz: b4706963e72a3f7366607eca5e5697f4363d6250963080b9a66f3ed1060e8461efb53c14c31f5a71e361f7d2447ea145db4018894ea5dd363fce4c4c20a91d2b
6
+ metadata.gz: 6a153185b4128ca6686fd671f663a882635bb221f45871893a4db1aec0f0d47cc9f2cb815ede58f15de097ecdf2581f47f0154957c034f58703bcb92f5b02447
7
+ data.tar.gz: 4cc6f596c60da5ce19319796dc6b8f9a47d40d4e80591ed310d6dd868c6d09ab23cfccf57a687a521a5a6549a2c96d7943fafacf3a5e377b5f0d6df92868c9ce
data/CHANGELOG.md CHANGED
@@ -5,6 +5,30 @@ 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.1] - 2026-10-09
9
+
10
+ ### Fixed
11
+
12
+ - `assets:precompile` no longer leaves out files written after
13
+ `andromeda:build`, such as `tailwind.css` from `tailwindcss:build`.
14
+ Checking a bare image path asked Propshaft's load path, which caches its
15
+ file list on the first lookup, so a fresh build (an empty
16
+ `app/assets/builds/`) shipped without them and every page raised
17
+ `Propshaft::MissingAssetError`. The check now looks at the files directly.
18
+
19
+ ## [0.6.0] - 2026-10-08
20
+
21
+ ### Added
22
+
23
+ - `Entry.replace_entries(list)` swaps a collection's entries in tests without
24
+ depending on internal cache variables; `reload!` restores the real ones.
25
+
26
+ ### Fixed
27
+
28
+ - The gem now requires `json < 3`, so `bundle update` no longer pulls in a
29
+ version that breaks session cookie decryption on Rails 8.1. The `Gemfile`
30
+ pin from the README is no longer needed.
31
+
8
32
  ## [0.5.0] - 2026-10-07
9
33
 
10
34
  ### Changed
@@ -153,6 +177,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
153
177
  - Generators: `andromeda:install`, `andromeda:collection`,
154
178
  `andromeda:component` and `andromeda:import_astro`.
155
179
 
180
+ [0.6.1]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.6.1
181
+ [0.6.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.6.0
156
182
  [0.5.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.5.0
157
183
  [0.4.2]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.2
158
184
  [0.4.1]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.1
data/README.md CHANGED
@@ -307,16 +307,27 @@ bundle exec rake test:corpus # after test/fetch_corpus.sh: parse ~370 real Astr
307
307
  ## Troubleshooting
308
308
 
309
309
  **`ArgumentError: wrong number of arguments (given 2, expected 1)` from `JSON.parse`.**
310
- Not this gem: Rails 8.1 calls `JSON.parse` with a positional options hash, which
311
- version 3 of the `json` gem no longer accepts, and decrypting a session cookie
312
- hits that path — so pages fail only once a session exists. Pin the `json` gem
313
- until Rails ships a fix:
310
+ Not this gem's code: Rails 8.1 calls `JSON.parse` with a positional options hash,
311
+ which version 3 of the `json` gem no longer accepts, and decrypting a session
312
+ cookie hits that path, so pages fail only once a session exists. The gem
313
+ restricts `json` to `< 3` to avoid this. If you are on an older andromeda_cms,
314
+ pin it in your own `Gemfile` until Rails ships a fix:
314
315
 
315
316
  ```ruby
316
317
  # Gemfile
317
318
  gem "json", "~> 2.9"
318
319
  ```
319
320
 
321
+ ## Testing
322
+
323
+ To run model tests against entries that are not files under `app/content`,
324
+ swap them in with `replace_entries` and restore the real ones with `reload!`:
325
+
326
+ ```ruby
327
+ setup { Content::Post.replace_entries([Content::Post.new(id: "a", collection: :posts, data: { title: "A" }, body: "", file_path: "a.md", digest: "x")]) }
328
+ teardown { Content::Post.reload! }
329
+ ```
330
+
320
331
  ## Contributing
321
332
 
322
333
  Bug reports are welcome; patches are not. Andromeda is open source but not open
@@ -76,20 +76,30 @@ module Andromeda
76
76
  # back to a plain /assets path for anything it cannot find, so without
77
77
  # this check a typo only shows up as a 404 in production.
78
78
  #
79
+ # This looks at the files directly instead of calling `load_path.find`:
80
+ # Propshaft memoizes its file list on the first lookup, and the same load
81
+ # path is later used by assets:precompile. Asking it during andromeda:build
82
+ # would hide every file written afterwards (tailwind.css from
83
+ # tailwindcss:build, images copied by `publish`) from the precompile.
84
+ #
79
85
  # @return [Boolean, nil] nil when there is no Propshaft load path to ask
80
86
  # (no asset pipeline, or Sprockets), so callers can skip the check.
81
87
  def exists?(logical_path)
82
88
  load_path = pipeline_load_path
83
89
  return nil if load_path.nil?
84
90
 
85
- !load_path.find(logical_path).nil?
91
+ path = logical_path.to_s
92
+ return false if path.start_with?("/") || path.split("/").include?("..")
93
+ return false if File.basename(path).start_with?(".")
94
+
95
+ load_path.paths.any? { |directory| File.file?(File.join(directory.to_s, path)) }
86
96
  end
87
97
 
88
98
  def pipeline_load_path
89
99
  return nil unless defined?(::Rails) && ::Rails.respond_to?(:application) && ::Rails.application
90
100
 
91
101
  assets = ::Rails.application.assets
92
- assets.respond_to?(:load_path) && assets.load_path.respond_to?(:find) ? assets.load_path : nil
102
+ assets.respond_to?(:load_path) && assets.load_path.respond_to?(:paths) ? assets.load_path : nil
93
103
  rescue StandardError
94
104
  nil
95
105
  end
@@ -184,6 +184,22 @@ module Andromeda
184
184
  @entries_signature = nil
185
185
  end
186
186
 
187
+ # Swaps the collection's entries for `list`, so tests can run against
188
+ # entries that are not backed by files under `app/content`. The cache
189
+ # signature is set to match the current source files, so the next query
190
+ # keeps `list` instead of noticing a mismatch and re-reading the files;
191
+ # setting `@entries` alone leaves the signature nil and the swap is
192
+ # silently undone. A later source file change, or `reload!`, restores
193
+ # the real entries.
194
+ #
195
+ # @param list [Array<Andromeda::Entry>]
196
+ # @return [Array<Andromeda::Entry>]
197
+ def replace_entries(list)
198
+ @entries = list.to_a.dup
199
+ @entries_signature = production? ? nil : source_signature
200
+ @entries
201
+ end
202
+
187
203
  private
188
204
 
189
205
  # Production never touches source files: everything a query
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Andromeda
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.1"
5
5
  end
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.5.0
4
+ version: 0.6.1
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-07 00:00:00.000000000 Z
11
+ date: 2026-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "<"
74
+ - !ruby/object:Gem::Version
75
+ version: '3'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '3'
69
83
  description: |
70
84
  Andromeda brings Astro's content collections to an ordinary Ruby on Rails
71
85
  app. Markdown and MDX files copied from an Astro project are validated