nacelle 0.6.0 → 0.6.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: 6477e57d6d1fe634a3c9a940e14dcf5b988895683e987d56d37246b81994a3eb
4
- data.tar.gz: 5c7d38c042003f3bc54c73806931c100fafcf259be9e923c36cb058301546ebc
3
+ metadata.gz: bc7d2280de3747f26a968df1e8862382c8e8ac5617ef3f9db4cf8159f8b2c249
4
+ data.tar.gz: 17cd8e85dd59919c94d15f07d08d0a51dbb5f8ad1a4e05d3d6267efde41e8a35
5
5
  SHA512:
6
- metadata.gz: ba15b649933306bb4ac18d5fd3a7e42660394d0105d795df93b6b6d6ca283a330727e370b6a169c4315d6df8e23f334b9afa369a33aa478d25c9f349dd41da2d
7
- data.tar.gz: a7f13c2431e3e8a9cc84246b28cfa5e1e0327c48d64dd462d71979d1ed68a944e8af0ba11e3f7b5d818bf14456374d474925e779fc195d282927dcbd30ca4bb6
6
+ metadata.gz: d5ce4bb55a621b8a014a4f76437ccd11015841dd2eb631a22fbdb389321d2009ff601b1a0e71c962a8c06122bec581a43d38a763adafc64a3ce0ad422cc91ebe
7
+ data.tar.gz: 398ed215fb0759151e64c7af48e516ea58d1c2c330cb05e06e145aeb32a9bd5411aafb1760b25e71bd01ee3e57caba50e8bfcece4dd09c6665250912ccb2da0f
@@ -5,8 +5,8 @@ jobs:
5
5
  strategy:
6
6
  fail-fast: false
7
7
  matrix:
8
- gemfile: [ rails_7.0, rails_7.1, rails_7.2 ]
9
- ruby: [ 3.1, 3.2, 3.3 ]
8
+ gemfile: [ rails_7.2, rails_8.0, rails_8.1 ]
9
+ ruby: [ 3.2, 3.3, 3.4 ]
10
10
 
11
11
  runs-on: ubuntu-latest
12
12
  env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
data/Appraisals CHANGED
@@ -1,12 +1,11 @@
1
- appraise "rails-7.0" do
2
- gem "rails", "~>7.0.0"
1
+ appraise "rails-7.2" do
2
+ gem "rails", "~>7.2.0"
3
3
  end
4
4
 
5
- appraise "rails-7.1" do
6
- gem "rails", "~>7.1.0"
5
+ appraise "rails-8.0" do
6
+ gem "rails", "~>8.0.0"
7
7
  end
8
8
 
9
- appraise "rails-7.2" do
10
- gem "rails", "~>7.2.0"
9
+ appraise "rails-8.1" do
10
+ gem "rails", "~>8.1.0"
11
11
  end
12
-
data/CLAUDE.md ADDED
@@ -0,0 +1,96 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ Nacelle is a Rails engine that enables embedding dynamic cell components into CMS content. It works by parsing `<cell>` tags in HTML responses and replacing them with rendered cell content via a controller after filter.
8
+
9
+ ## Core Architecture
10
+
11
+ ### Cell Execution Flow
12
+
13
+ 1. **Request Processing**: HTML responses flow through `Nacelle::AfterFilter` global controller after filter (registered in `lib/nacelle.rb:11`)
14
+ 2. **Tag Parsing**: AfterFilter scans the response body for `<cell>` tags using regex and XML parsing (`lib/nacelle/after_filter.rb:38-46`)
15
+ 3. **Cell Instantiation**: Tags like `<cell name="my_account/form" />` are converted to `MyAccountCell#form` calls
16
+ 4. **Rendering**: Cells render their views from `app/cells/` directory structure
17
+
18
+ ### Key Components
19
+
20
+ - **Nacelle::Cell** (`lib/nacelle/cell.rb`): Base class for all cells
21
+ - Provides controller context (request, session, cookies) to cells
22
+ - Implements custom rendering that looks up views in `app/cells/` directory
23
+ - Supports helper modules and helper methods
24
+ - Has cache key/timestamp methods for fragment caching
25
+
26
+ - **Nacelle::AfterFilter** (`lib/nacelle/after_filter.rb`): Middleware that processes HTML responses
27
+ - Only processes `text/html` content types
28
+ - Parses `<cell name="cell_name/action" attr="value" />` tags
29
+ - Instantiates cell classes and invokes actions with attributes
30
+
31
+ - **Nacelle::HasCells** (`lib/nacelle/has_cells.rb`): ActiveRecord mixin
32
+ - Use `has_cells :column_name` to scan model columns for embedded cells
33
+ - Returns array of cell classes found in the content
34
+
35
+ - **Nacelle::CellsSerializer** (`lib/nacelle/cells_serializer.rb`): JSON API for CKEditor integration
36
+ - Endpoint at `/nacelle/cells.json` lists all available cells and their actions
37
+ - Discovers cells by requiring all files in `app/cells/*.rb`
38
+ - Optionally loads form HTML from `app/cells/{cell}/{action}_form.html.erb`
39
+
40
+ ### Cell Conventions
41
+
42
+ - Cell classes must inherit from `Nacelle::Cell` to appear in CKEditor
43
+ - Cell class names follow pattern: `{Name}Cell` (e.g., `TestCell`, `MyAccountCell`)
44
+ - Cell views live in `app/cells/{cell_name}/{action}.html.erb`
45
+ - Actions can accept zero arguments or a hash of attributes
46
+ - Action methods are alphabetically ordered in the CKEditor menu
47
+
48
+ ## Development Commands
49
+
50
+ ### Running Tests
51
+ ```bash
52
+ bundle exec rake # Run all specs (default task)
53
+ bundle exec rspec # Run all specs
54
+ bundle exec rspec spec/acceptance/nacelle_spec.rb # Run specific spec file
55
+ ```
56
+
57
+ ### Testing Across Rails Versions
58
+ ```bash
59
+ bundle exec appraisal install # Install dependencies for all Rails versions
60
+ bundle exec appraisal rails-7.1 rspec # Run specs against specific Rails version
61
+ ```
62
+
63
+ ## Testing Setup
64
+
65
+ The test suite uses RSpec with Capybara for acceptance testing. The spec creates a minimal Rails test app inline (`spec/acceptance/nacelle_spec.rb:5-16`) to test the engine's middleware behavior in a realistic environment.
66
+
67
+ When writing new tests:
68
+ - Place acceptance tests in `spec/acceptance/`
69
+ - The test app is configured with `secret_key_base`, `eager_load: false`, and `hosts: nil`
70
+ - Test cells should inherit from `Nacelle::Cell` and set `view_path` appropriately
71
+
72
+ ## File Structure
73
+
74
+ ```
75
+ lib/nacelle/
76
+ ├── cell.rb # Base cell class with rendering logic
77
+ ├── after_filter.rb # Middleware for processing <cell> tags
78
+ ├── has_cells.rb # ActiveRecord mixin for scanning content
79
+ └── cells_serializer.rb # JSON API for CKEditor integration
80
+
81
+ app/
82
+ ├── controllers/nacelle/
83
+ │ └── cells_controller.rb # Serves JSON list of cells
84
+ └── assets/javascripts/
85
+ ├── nacelle/ckeditor.js # CKEditor integration entry point
86
+ └── ckeditor/plugins/cells/ # CKEditor plugin for inserting cells
87
+ ```
88
+
89
+ ## Important Implementation Details
90
+
91
+ - Cell tag parsing uses `Hash.from_xml` (requires Nokogiri backend)
92
+ - The AfterFilter runs on all ActionController::Base after_actions
93
+ - Cell names in tags use underscore format: `<cell name="my_account/form" />`
94
+ - Cell classes use CamelCase: `MyAccountCell`
95
+ - Action arity is checked to determine whether to pass attributes hash
96
+ - Missing cells/actions render error message: `<strong>Cell "{name} {action}" not found!</strong>`
data/Gemfile CHANGED
@@ -3,4 +3,4 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in nacelle.gemspec
4
4
  gemspec
5
5
 
6
- gem "rails", "~>7.1.0"
6
+ gem "rails", "~>8.0.0"
@@ -3,6 +3,5 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~>7.2.0"
6
- gem "sprockets", "~>3.0"
7
6
 
8
7
  gemspec path: "../"
@@ -1,74 +1,77 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- nacelle (0.5.0)
4
+ nacelle (0.6.0)
5
5
  rails
6
6
  sprockets-rails
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.2.1)
12
- actionpack (= 7.2.1)
13
- activesupport (= 7.2.1)
11
+ actioncable (7.2.3)
12
+ actionpack (= 7.2.3)
13
+ activesupport (= 7.2.3)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
16
  zeitwerk (~> 2.6)
17
- actionmailbox (7.2.1)
18
- actionpack (= 7.2.1)
19
- activejob (= 7.2.1)
20
- activerecord (= 7.2.1)
21
- activestorage (= 7.2.1)
22
- activesupport (= 7.2.1)
17
+ actionmailbox (7.2.3)
18
+ actionpack (= 7.2.3)
19
+ activejob (= 7.2.3)
20
+ activerecord (= 7.2.3)
21
+ activestorage (= 7.2.3)
22
+ activesupport (= 7.2.3)
23
23
  mail (>= 2.8.0)
24
- actionmailer (7.2.1)
25
- actionpack (= 7.2.1)
26
- actionview (= 7.2.1)
27
- activejob (= 7.2.1)
28
- activesupport (= 7.2.1)
24
+ actionmailer (7.2.3)
25
+ actionpack (= 7.2.3)
26
+ actionview (= 7.2.3)
27
+ activejob (= 7.2.3)
28
+ activesupport (= 7.2.3)
29
29
  mail (>= 2.8.0)
30
30
  rails-dom-testing (~> 2.2)
31
- actionpack (7.2.1)
32
- actionview (= 7.2.1)
33
- activesupport (= 7.2.1)
31
+ actionpack (7.2.3)
32
+ actionview (= 7.2.3)
33
+ activesupport (= 7.2.3)
34
+ cgi
34
35
  nokogiri (>= 1.8.5)
35
36
  racc
36
- rack (>= 2.2.4, < 3.2)
37
+ rack (>= 2.2.4, < 3.3)
37
38
  rack-session (>= 1.0.1)
38
39
  rack-test (>= 0.6.3)
39
40
  rails-dom-testing (~> 2.2)
40
41
  rails-html-sanitizer (~> 1.6)
41
42
  useragent (~> 0.16)
42
- actiontext (7.2.1)
43
- actionpack (= 7.2.1)
44
- activerecord (= 7.2.1)
45
- activestorage (= 7.2.1)
46
- activesupport (= 7.2.1)
43
+ actiontext (7.2.3)
44
+ actionpack (= 7.2.3)
45
+ activerecord (= 7.2.3)
46
+ activestorage (= 7.2.3)
47
+ activesupport (= 7.2.3)
47
48
  globalid (>= 0.6.0)
48
49
  nokogiri (>= 1.8.5)
49
- actionview (7.2.1)
50
- activesupport (= 7.2.1)
50
+ actionview (7.2.3)
51
+ activesupport (= 7.2.3)
51
52
  builder (~> 3.1)
53
+ cgi
52
54
  erubi (~> 1.11)
53
55
  rails-dom-testing (~> 2.2)
54
56
  rails-html-sanitizer (~> 1.6)
55
- activejob (7.2.1)
56
- activesupport (= 7.2.1)
57
+ activejob (7.2.3)
58
+ activesupport (= 7.2.3)
57
59
  globalid (>= 0.3.6)
58
- activemodel (7.2.1)
59
- activesupport (= 7.2.1)
60
- activerecord (7.2.1)
61
- activemodel (= 7.2.1)
62
- activesupport (= 7.2.1)
60
+ activemodel (7.2.3)
61
+ activesupport (= 7.2.3)
62
+ activerecord (7.2.3)
63
+ activemodel (= 7.2.3)
64
+ activesupport (= 7.2.3)
63
65
  timeout (>= 0.4.0)
64
- activestorage (7.2.1)
65
- actionpack (= 7.2.1)
66
- activejob (= 7.2.1)
67
- activerecord (= 7.2.1)
68
- activesupport (= 7.2.1)
66
+ activestorage (7.2.3)
67
+ actionpack (= 7.2.3)
68
+ activejob (= 7.2.3)
69
+ activerecord (= 7.2.3)
70
+ activesupport (= 7.2.3)
69
71
  marcel (~> 1.0)
70
- activesupport (7.2.1)
72
+ activesupport (7.2.3)
71
73
  base64
74
+ benchmark (>= 0.3)
72
75
  bigdecimal
73
76
  concurrent-ruby (~> 1.0, >= 1.3.1)
74
77
  connection_pool (>= 2.2.5)
@@ -84,10 +87,11 @@ GEM
84
87
  bundler
85
88
  rake
86
89
  thor (>= 0.14.0)
87
- base64 (0.2.0)
88
- bigdecimal (3.1.8)
90
+ base64 (0.3.0)
91
+ benchmark (0.5.0)
92
+ bigdecimal (3.3.1)
89
93
  builder (3.3.0)
90
- byebug (11.1.3)
94
+ byebug (12.0.0)
91
95
  capybara (3.40.0)
92
96
  addressable
93
97
  matrix
@@ -97,128 +101,141 @@ GEM
97
101
  rack-test (>= 0.6.3)
98
102
  regexp_parser (>= 1.5, < 3.0)
99
103
  xpath (~> 3.2)
100
- concurrent-ruby (1.3.4)
101
- connection_pool (2.4.1)
104
+ cgi (0.5.0)
105
+ concurrent-ruby (1.3.5)
106
+ connection_pool (2.5.4)
102
107
  crass (1.0.6)
103
- date (3.3.4)
104
- diff-lcs (1.5.1)
105
- drb (2.2.1)
106
- erubi (1.13.0)
107
- globalid (1.2.1)
108
+ date (3.5.0)
109
+ diff-lcs (1.6.2)
110
+ drb (2.2.3)
111
+ erb (5.1.3)
112
+ erubi (1.13.1)
113
+ globalid (1.3.0)
108
114
  activesupport (>= 6.1)
109
- i18n (1.14.5)
115
+ i18n (1.14.7)
110
116
  concurrent-ruby (~> 1.0)
111
- io-console (0.7.2)
112
- irb (1.14.0)
117
+ io-console (0.8.1)
118
+ irb (1.15.3)
119
+ pp (>= 0.6.0)
113
120
  rdoc (>= 4.0.0)
114
121
  reline (>= 0.4.2)
115
- logger (1.6.0)
116
- loofah (2.22.0)
122
+ logger (1.7.0)
123
+ loofah (2.24.1)
117
124
  crass (~> 1.0.2)
118
125
  nokogiri (>= 1.12.0)
119
- mail (2.8.1)
126
+ mail (2.9.0)
127
+ logger
120
128
  mini_mime (>= 0.1.1)
121
129
  net-imap
122
130
  net-pop
123
131
  net-smtp
124
- marcel (1.0.4)
125
- matrix (0.4.2)
132
+ marcel (1.1.0)
133
+ matrix (0.4.3)
126
134
  mini_mime (1.1.5)
127
- minitest (5.25.1)
128
- net-imap (0.4.14)
135
+ minitest (5.26.0)
136
+ net-imap (0.5.12)
129
137
  date
130
138
  net-protocol
131
139
  net-pop (0.1.2)
132
140
  net-protocol
133
141
  net-protocol (0.2.2)
134
142
  timeout
135
- net-smtp (0.5.0)
143
+ net-smtp (0.5.1)
136
144
  net-protocol
137
- nio4r (2.7.3)
138
- nokogiri (1.16.7-x86_64-linux)
145
+ nio4r (2.7.5)
146
+ nokogiri (1.18.10-x86_64-linux-gnu)
139
147
  racc (~> 1.4)
140
- psych (5.1.2)
148
+ pp (0.6.3)
149
+ prettyprint
150
+ prettyprint (0.2.0)
151
+ psych (5.2.6)
152
+ date
141
153
  stringio
142
- public_suffix (6.0.1)
154
+ public_suffix (6.0.2)
143
155
  racc (1.8.1)
144
- rack (2.2.9)
145
- rack-session (1.0.2)
146
- rack (< 3)
147
- rack-test (2.1.0)
156
+ rack (3.2.4)
157
+ rack-session (2.1.1)
158
+ base64 (>= 0.1.0)
159
+ rack (>= 3.0.0)
160
+ rack-test (2.2.0)
148
161
  rack (>= 1.3)
149
- rackup (1.0.0)
150
- rack (< 3)
151
- webrick
152
- rails (7.2.1)
153
- actioncable (= 7.2.1)
154
- actionmailbox (= 7.2.1)
155
- actionmailer (= 7.2.1)
156
- actionpack (= 7.2.1)
157
- actiontext (= 7.2.1)
158
- actionview (= 7.2.1)
159
- activejob (= 7.2.1)
160
- activemodel (= 7.2.1)
161
- activerecord (= 7.2.1)
162
- activestorage (= 7.2.1)
163
- activesupport (= 7.2.1)
162
+ rackup (2.2.1)
163
+ rack (>= 3)
164
+ rails (7.2.3)
165
+ actioncable (= 7.2.3)
166
+ actionmailbox (= 7.2.3)
167
+ actionmailer (= 7.2.3)
168
+ actionpack (= 7.2.3)
169
+ actiontext (= 7.2.3)
170
+ actionview (= 7.2.3)
171
+ activejob (= 7.2.3)
172
+ activemodel (= 7.2.3)
173
+ activerecord (= 7.2.3)
174
+ activestorage (= 7.2.3)
175
+ activesupport (= 7.2.3)
164
176
  bundler (>= 1.15.0)
165
- railties (= 7.2.1)
166
- rails-dom-testing (2.2.0)
177
+ railties (= 7.2.3)
178
+ rails-dom-testing (2.3.0)
167
179
  activesupport (>= 5.0.0)
168
180
  minitest
169
181
  nokogiri (>= 1.6)
170
- rails-html-sanitizer (1.6.0)
182
+ rails-html-sanitizer (1.6.2)
171
183
  loofah (~> 2.21)
172
- nokogiri (~> 1.14)
173
- railties (7.2.1)
174
- actionpack (= 7.2.1)
175
- activesupport (= 7.2.1)
184
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
185
+ railties (7.2.3)
186
+ actionpack (= 7.2.3)
187
+ activesupport (= 7.2.3)
188
+ cgi
176
189
  irb (~> 1.13)
177
190
  rackup (>= 1.0.0)
178
191
  rake (>= 12.2)
179
192
  thor (~> 1.0, >= 1.2.2)
193
+ tsort (>= 0.2)
180
194
  zeitwerk (~> 2.6)
181
- rake (13.2.1)
182
- rdoc (6.7.0)
195
+ rake (13.3.1)
196
+ rdoc (6.15.1)
197
+ erb
183
198
  psych (>= 4.0.0)
184
- regexp_parser (2.9.2)
185
- reline (0.5.9)
199
+ tsort
200
+ regexp_parser (2.11.3)
201
+ reline (0.6.2)
186
202
  io-console (~> 0.5)
187
- rspec (3.13.0)
203
+ rspec (3.13.2)
188
204
  rspec-core (~> 3.13.0)
189
205
  rspec-expectations (~> 3.13.0)
190
206
  rspec-mocks (~> 3.13.0)
191
- rspec-core (3.13.0)
207
+ rspec-core (3.13.6)
192
208
  rspec-support (~> 3.13.0)
193
- rspec-expectations (3.13.2)
209
+ rspec-expectations (3.13.5)
194
210
  diff-lcs (>= 1.2.0, < 2.0)
195
211
  rspec-support (~> 3.13.0)
196
- rspec-mocks (3.13.1)
212
+ rspec-mocks (3.13.7)
197
213
  diff-lcs (>= 1.2.0, < 2.0)
198
214
  rspec-support (~> 3.13.0)
199
- rspec-support (3.13.1)
200
- securerandom (0.3.1)
201
- sprockets (3.7.3)
202
- base64
215
+ rspec-support (3.13.6)
216
+ securerandom (0.4.1)
217
+ sprockets (4.2.2)
203
218
  concurrent-ruby (~> 1.0)
204
- rack (> 1, < 3)
219
+ logger
220
+ rack (>= 2.2.4, < 4)
205
221
  sprockets-rails (3.5.2)
206
222
  actionpack (>= 6.1)
207
223
  activesupport (>= 6.1)
208
224
  sprockets (>= 3.0.0)
209
- stringio (3.1.1)
210
- thor (1.3.1)
211
- timeout (0.4.1)
225
+ stringio (3.1.7)
226
+ thor (1.4.0)
227
+ timeout (0.4.4)
228
+ tsort (0.2.0)
212
229
  tzinfo (2.0.6)
213
230
  concurrent-ruby (~> 1.0)
214
- useragent (0.16.10)
215
- webrick (1.8.1)
216
- websocket-driver (0.7.6)
231
+ useragent (0.16.11)
232
+ websocket-driver (0.8.0)
233
+ base64
217
234
  websocket-extensions (>= 0.1.0)
218
235
  websocket-extensions (0.1.5)
219
236
  xpath (3.2.0)
220
237
  nokogiri (~> 1.8)
221
- zeitwerk (2.6.17)
238
+ zeitwerk (2.7.3)
222
239
 
223
240
  PLATFORMS
224
241
  x86_64-linux
@@ -232,7 +249,6 @@ DEPENDENCIES
232
249
  rails (~> 7.2.0)
233
250
  rake
234
251
  rspec
235
- sprockets (~> 3.0)
236
252
 
237
253
  BUNDLED WITH
238
254
  2.4.19
@@ -2,7 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~>7.0.0"
6
- gem "sprockets", "~>3.0"
5
+ gem "rails", "~>8.0.0"
7
6
 
8
7
  gemspec path: "../"