Commit 85ab667
authored
feat: migrate to zeitwerk (#878)
This pull request introduces a major refactor of the backend code
structure to adopt the Zeitwerk autoloader, improves backend
maintainability, and updates development and linting workflows. It
removes manual requires and directory-specific namespace wiring,
reorganizes files under the `app/web/**` directory, and ensures that all
code is autoloaded in a consistent, Rails-like fashion. Additionally, it
adds a Zeitwerk eager-load check to the linting process and updates
documentation accordingly. Several files are renamed or removed to
reflect the new structure, and some error-handling and validation logic
is refactored for clarity and consistency.
**Backend autoloading and structure improvements:**
- Introduced the `zeitwerk` gem and removed the `rack-unreloader` gem,
enabling Zeitwerk-based autoloading for backend code under the
`Html2rss::Web` namespace, and updated `app.rb` to use
`Html2rss::Web::Boot` for setup and eager loading.
[[1]](diffhunk://#diff-d09ea66f8227784ff4393d88a19836f321c915ae10031d16c93d67e6283ab55fR20-L25)
[[2]](diffhunk://#diff-f965f92b425fb2f75d38b491b2625fe21b8af20b7666217546bce8a42b198ea4L9-R12)
- Moved backend files into the `app/web/**` directory to match
Zeitwerk's expectations, and removed manual `require` statements in
favor of autoloading.
[[1]](diffhunk://#diff-f965f92b425fb2f75d38b491b2625fe21b8af20b7666217546bce8a42b198ea4L9-R12)
[[2]](diffhunk://#diff-17e1b7bf4af1869b4be3173dde8b6bffaff1e1e2a6e767b728c9a9f3685d490fL1-L52)
[[3]](diffhunk://#diff-02e7c9c52be0b12bd7c0a8910a098e50de253b9654172526667dec2bfdba4970L1-L57)
[[4]](diffhunk://#diff-884604050285643eb6fb29195c6342cd73a3abae7f3acba5b1bbc41a196d31e3L1-L70)
[[5]](diffhunk://#diff-9df4f6ed17ac1a74c68891a27d537de8e617e0b99e7803fbf42ab523a7043bb6L1-L158)
[[6]](diffhunk://#diff-f2b0bbe2a08fb1204f3985f426ee5aeda21d24f8d4b598e4162b43d87649b674L3-R11)
[[7]](diffhunk://#diff-0764627d99177e329667ae8f5c98c756ac3d8ae43bdf768b3af26403f713e281L6-R15)
**Development and linting workflow updates:**
- Added a Zeitwerk eager-load verification task (`rake zeitwerk:verify`)
to the `Makefile` linting process and as part of `make ready`, ensuring
loader drift is caught early in development.
[[1]](diffhunk://#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R61-R62)
[[2]](diffhunk://#diff-ee98e028c59b193d58fde56ab4daf54d43c486ae674e63d50ddf300b07943e0fR142-R152)
[[3]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R69-R72)
**Error handling and validation refactoring:**
- Updated error handling in API modules to reference error classes via
the fully qualified `Html2rss::Web` namespace, and refactored validation
logic in `CreateFeed` for clarity and maintainability.
[[1]](diffhunk://#diff-0764627d99177e329667ae8f5c98c756ac3d8ae43bdf768b3af26403f713e281L44-R43)
[[2]](diffhunk://#diff-0764627d99177e329667ae8f5c98c756ac3d8ae43bdf768b3af26403f713e281L60-R80)
[[3]](diffhunk://#diff-0764627d99177e329667ae8f5c98c756ac3d8ae43bdf768b3af26403f713e281R90-R95)
[[4]](diffhunk://#diff-0764627d99177e329667ae8f5c98c756ac3d8ae43bdf768b3af26403f713e281L112-R123)
[[5]](diffhunk://#diff-0764627d99177e329667ae8f5c98c756ac3d8ae43bdf768b3af26403f713e281L134-R141)
**Roda plugin and middleware changes:**
- Added the `:head` and `:not_allowed` plugins to Roda configuration,
improving HTTP method handling.
**Documentation updates:**
- Updated `README.md` to explain the new backend file structure,
Zeitwerk integration, and contributor guidelines for backend code
placement.1 parent 4701231 commit 85ab667
87 files changed
Lines changed: 1030 additions & 582 deletions
File tree
- app
- api/v1
- domain
- errors
- routes
- web
- api/v1
- boot
- config
- domain
- errors
- feeds
- http
- rendering
- request
- routes
- api_v1
- security
- telemetry
- docs
- frontend/src
- __tests__
- hooks
- styles
- spec
- html2rss/web
- api
- v1
- boot
- feeds
- smoke
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
250 | 249 | | |
251 | 250 | | |
252 | 251 | | |
| |||
375 | 374 | | |
376 | 375 | | |
377 | 376 | | |
378 | | - | |
379 | 377 | | |
380 | 378 | | |
381 | 379 | | |
| |||
393 | 391 | | |
394 | 392 | | |
395 | 393 | | |
| 394 | + | |
396 | 395 | | |
397 | 396 | | |
398 | 397 | | |
| |||
483 | 482 | | |
484 | 483 | | |
485 | 484 | | |
486 | | - | |
487 | 485 | | |
488 | 486 | | |
489 | 487 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | 37 | | |
42 | 38 | | |
43 | 39 | | |
| |||
85 | 81 | | |
86 | 82 | | |
87 | 83 | | |
| 84 | + | |
| 85 | + | |
88 | 86 | | |
89 | 87 | | |
90 | 88 | | |
| |||
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments