sun-sword 0.0.10 → 0.0.12

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -2
  3. data/Gemfile +20 -0
  4. data/Gemfile.lock +252 -0
  5. data/README.md +74 -15
  6. data/Rakefile +6 -10
  7. data/lib/generators/sun_sword/USAGE +22 -3
  8. data/lib/generators/sun_sword/frontend_generator.rb +77 -39
  9. data/lib/generators/sun_sword/frontend_generator_spec.rb +539 -0
  10. data/lib/generators/sun_sword/init_generator.rb +2 -0
  11. data/lib/generators/sun_sword/init_generator_spec.rb +82 -0
  12. data/lib/generators/sun_sword/scaffold_generator.rb +212 -29
  13. data/lib/generators/sun_sword/scaffold_generator_spec.rb +1414 -0
  14. data/lib/generators/sun_sword/templates_frontend/{Procfile.dev → Procfile.dev.tt} +1 -0
  15. data/lib/generators/sun_sword/templates_frontend/bin/{watch → watch.tt} +2 -1
  16. data/lib/generators/sun_sword/templates_frontend/config/{vite.json → vite.json.tt} +2 -1
  17. data/lib/generators/sun_sword/templates_frontend/controllers/application_controller.rb.tt +2 -2
  18. data/lib/generators/sun_sword/templates_frontend/controllers/tests_controller.rb +36 -0
  19. data/lib/generators/sun_sword/templates_frontend/controllers/tests_controller_spec.rb +62 -0
  20. data/lib/generators/sun_sword/templates_frontend/env.development +1 -1
  21. data/lib/generators/sun_sword/templates_frontend/frontend/entrypoints/application.js +2 -2
  22. data/lib/generators/sun_sword/templates_frontend/frontend/pages/tests-stimulus.js +31 -0
  23. data/lib/generators/sun_sword/templates_frontend/frontend/pages/web.js +12 -0
  24. data/lib/generators/sun_sword/templates_frontend/frontend/stylesheets/application.css +1 -3
  25. data/lib/generators/sun_sword/templates_frontend/helpers/application_helper.rb +17 -0
  26. data/lib/generators/sun_sword/templates_frontend/helpers/application_helper_spec.rb +30 -0
  27. data/lib/generators/sun_sword/templates_frontend/package.json.tt +14 -0
  28. data/lib/generators/sun_sword/templates_frontend/views/components/_action_destroy.html.erb.tt +1 -1
  29. data/lib/generators/sun_sword/templates_frontend/views/components/_alert.html.erb.tt +1 -1
  30. data/lib/generators/sun_sword/templates_frontend/views/layouts/application.html.erb.tt +3 -3
  31. data/lib/generators/sun_sword/templates_frontend/views/tests/_frame_content.html.erb +9 -0
  32. data/lib/generators/sun_sword/templates_frontend/views/tests/_log_entry.html.erb +4 -0
  33. data/lib/generators/sun_sword/templates_frontend/views/tests/_updated_content.html.erb +6 -0
  34. data/lib/generators/sun_sword/templates_frontend/views/tests/stimulus.html.erb +45 -0
  35. data/lib/generators/sun_sword/templates_frontend/views/tests/turbo_drive.html.erb +55 -0
  36. data/lib/generators/sun_sword/templates_frontend/views/tests/turbo_frame.html.erb +87 -0
  37. data/lib/generators/sun_sword/templates_frontend/vite.config.ts.tt +1 -1
  38. data/lib/generators/sun_sword/templates_init/config/initializers/sun_sword.rb +1 -0
  39. data/lib/generators/sun_sword/templates_scaffold/controllers/controller.rb.tt +24 -24
  40. data/lib/generators/sun_sword/templates_scaffold/controllers/controller_spec.rb.tt +398 -0
  41. data/lib/generators/sun_sword/templates_scaffold/views/index.html.erb.tt +5 -5
  42. data/lib/generators/sun_sword/templates_scaffold/views/show.html.erb.tt +3 -0
  43. data/lib/generators/tmp/db/structures/test_structure.yaml +42 -0
  44. data/lib/sun-sword.rb +1 -0
  45. data/lib/sun_sword/configuration_spec.rb +77 -0
  46. data/lib/sun_sword/version.rb +1 -1
  47. metadata +177 -29
  48. data/.rspec +0 -3
  49. data/.rubocop.yml +0 -1146
  50. data/lib/generators/sun_sword/templates_frontend/controllers/site_controller.rb +0 -16
  51. data/lib/generators/sun_sword/templates_frontend/db/seeds.rb +0 -3
  52. data/lib/generators/sun_sword/templates_frontend/db/structures/example.yaml.tt +0 -106
  53. data/lib/generators/sun_sword/templates_frontend/frontend/pages/stimulus.js +0 -10
  54. data/lib/generators/sun_sword/templates_frontend/package.json +0 -7
  55. data/lib/generators/sun_sword/templates_frontend/views/site/_comment.html.erb.tt +0 -3
  56. data/lib/generators/sun_sword/templates_frontend/views/site/stimulus.html.erb.tt +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3549043ef82d7091d8e6d984f86eefaf03ea039f2844f34f2b4f73e308006e1
4
- data.tar.gz: 7d311b8b6e938425160c8d83d9a4122c7ced6271cec8e361caf91156b407c99b
3
+ metadata.gz: e7f2301ad37844f511cef0f9439948ee35b7e74411e7a28989fcac4ff0ed3bb4
4
+ data.tar.gz: e37e5d005d3cb2fc82ce039570f9f6f5117c7347d4b1cc1c662df60b62fc85d3
5
5
  SHA512:
6
- metadata.gz: 8d1e7a1946d73a1172608407db3d9edfb29d7832445cbd6eeb75bc648f05934250be28f1bc614b00e757a5984b08cd4ab82b8a22f60c994ad715bf0b21faa523
7
- data.tar.gz: 9617f1d30d53033195b5387d677c79526db7744550529f51828a3b6470f2aca849b755e666c64190de81121d0e2880fbd0157be400f1789e2ec1a4f0e00f2fbb
6
+ metadata.gz: cbc03f139610daf61f3c260efac697aa0229aba1bccd608a1d207fccdf74254e43f639870a09d0f6b8ae80b6c21f3436e1ec935368934c65accf25a5d5fd2646
7
+ data.tar.gz: 88ea0d19496ba67f716f7d1479b99e03efb8191c4609bc3c08c5d7131cac98204e4a9f634a2572e548873f1fca0cc612b4db9a0780f82fa355418c5ac76c9d5e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
1
8
  ## [Unreleased]
2
9
 
3
- ## [0.1.0] - 2024-09-08
10
+ ### Changed
11
+ - 🔄 Removed engine support from frontend generator only
12
+ - 🔄 Scaffold generator retains full engine support with `--engine` and `--engine_structure` options
13
+ - 📝 Updated documentation to clarify engine support differences
14
+
15
+ ## [0.0.12] - 2025-11-07
16
+
17
+ ### Added
18
+ - ✨ Engine support for frontend generator with `--engine` option
19
+ - ✨ Engine support for scaffold generator with `--engine` option
20
+ - ✨ `--engine_structure` option to load structure files from different engines
21
+ - ✨ Auto-detect engine paths (engines/, components/, gems/)
22
+ - ✨ Multiple engine support for modular Rails applications
23
+ - 📝 ENGINE_SUPPORT.md comprehensive documentation
24
+ - 📝 Updated USAGE with engine examples
25
+
26
+ ### Changed
27
+ - 🔄 Frontend generator now supports path_app helper for engine routing
28
+ - 🔄 Scaffold generator now supports engine-specific paths
29
+ - 🔄 Structure file path resolution supports engines
30
+ - 📝 Updated README with engine usage examples
31
+
32
+ ### Fixed
33
+ - 🐛 All path references now use helpers for engine compatibility
34
+
35
+ ## [0.0.11] - 2025-11-07
36
+
37
+ ### Changed
38
+ - 🔄 Migrated from Yarn/NPM to Bun for faster package management
39
+ - 🔄 Updated all `yarn` commands to `bun` commands
40
+ - 📦 All frontend dependencies now installed via Bun
41
+
42
+ ### Added
43
+ - ✨ RSpec structure matching rider-kick (co-located specs)
44
+ - ✨ generator_spec gem for better generator testing
45
+ - ✨ Support directory for test helpers
46
+ - 📝 MIGRATION_TO_BUN.md documentation
47
+
48
+ ### Fixed
49
+ - ✅ All 37 RSpec tests now passing
50
+ - 🧹 Cleaned up root-level development artifacts
51
+
52
+ ## [0.0.1] - 2024-01-01
53
+
54
+ ### Added
55
+ - 🎉 Initial release
56
+ - ⚡ Vite + Tailwind v4 + Hotwire (Turbo + Stimulus) integration
57
+ - 🎨 Frontend generator with modern stack
58
+ - 📝 Scaffold generator for Clean Architecture
59
+ - 🏗️ View scaffolds aligned with domain
4
60
 
5
- - Initial release
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in sun-sword.gemspec
6
+ gemspec
7
+
8
+ group :development, :test do
9
+ gem 'byebug'
10
+ gem 'rubocop-performance'
11
+ gem 'rubocop-rails-omakase', require: false
12
+ end
13
+ # --- SunSword Package frontend
14
+ gem 'stimulus-rails'
15
+ gem 'turbo-rails'
16
+ gem 'vite_rails'
17
+
18
+ group :development do
19
+ gem 'listen'
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,252 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sun-sword (0.0.12)
5
+ activesupport (>= 7.0, < 9.0)
6
+ hashie (>= 5.0, < 6.0)
7
+ thor (>= 1.2, < 2.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionpack (8.1.1)
13
+ actionview (= 8.1.1)
14
+ activesupport (= 8.1.1)
15
+ nokogiri (>= 1.8.5)
16
+ rack (>= 2.2.4)
17
+ rack-session (>= 1.0.1)
18
+ rack-test (>= 0.6.3)
19
+ rails-dom-testing (~> 2.2)
20
+ rails-html-sanitizer (~> 1.6)
21
+ useragent (~> 0.16)
22
+ actionview (8.1.1)
23
+ activesupport (= 8.1.1)
24
+ builder (~> 3.1)
25
+ erubi (~> 1.11)
26
+ rails-dom-testing (~> 2.2)
27
+ rails-html-sanitizer (~> 1.6)
28
+ activesupport (8.1.1)
29
+ base64
30
+ bigdecimal
31
+ concurrent-ruby (~> 1.0, >= 1.3.1)
32
+ connection_pool (>= 2.2.5)
33
+ drb
34
+ i18n (>= 1.6, < 2)
35
+ json
36
+ logger (>= 1.4.2)
37
+ minitest (>= 5.1)
38
+ securerandom (>= 0.3)
39
+ tzinfo (~> 2.0, >= 2.0.5)
40
+ uri (>= 0.13.1)
41
+ appraisal (2.5.0)
42
+ bundler
43
+ rake
44
+ thor (>= 0.14.0)
45
+ ast (2.4.3)
46
+ base64 (0.3.0)
47
+ bigdecimal (3.3.1)
48
+ builder (3.3.0)
49
+ byebug (12.0.0)
50
+ concurrent-ruby (1.3.5)
51
+ connection_pool (2.5.5)
52
+ crass (1.0.6)
53
+ date (3.5.0)
54
+ diff-lcs (1.6.2)
55
+ drb (2.2.3)
56
+ dry-cli (1.3.0)
57
+ erb (6.0.0)
58
+ erubi (1.13.1)
59
+ ffi (1.17.2-aarch64-linux-gnu)
60
+ ffi (1.17.2-aarch64-linux-musl)
61
+ ffi (1.17.2-arm-linux-gnu)
62
+ ffi (1.17.2-arm-linux-musl)
63
+ ffi (1.17.2-arm64-darwin)
64
+ ffi (1.17.2-x86_64-darwin)
65
+ ffi (1.17.2-x86_64-linux-gnu)
66
+ ffi (1.17.2-x86_64-linux-musl)
67
+ generator_spec (0.10.0)
68
+ activesupport (>= 3.0.0)
69
+ railties (>= 3.0.0)
70
+ hashie (5.0.0)
71
+ i18n (1.14.7)
72
+ concurrent-ruby (~> 1.0)
73
+ io-console (0.8.1)
74
+ irb (1.15.3)
75
+ pp (>= 0.6.0)
76
+ rdoc (>= 4.0.0)
77
+ reline (>= 0.4.2)
78
+ json (2.16.0)
79
+ language_server-protocol (3.17.0.5)
80
+ lint_roller (1.1.0)
81
+ listen (3.9.0)
82
+ rb-fsevent (~> 0.10, >= 0.10.3)
83
+ rb-inotify (~> 0.9, >= 0.9.10)
84
+ logger (1.7.0)
85
+ loofah (2.24.1)
86
+ crass (~> 1.0.2)
87
+ nokogiri (>= 1.12.0)
88
+ minitest (5.26.2)
89
+ mutex_m (0.3.0)
90
+ nokogiri (1.18.10-aarch64-linux-gnu)
91
+ racc (~> 1.4)
92
+ nokogiri (1.18.10-aarch64-linux-musl)
93
+ racc (~> 1.4)
94
+ nokogiri (1.18.10-arm-linux-gnu)
95
+ racc (~> 1.4)
96
+ nokogiri (1.18.10-arm-linux-musl)
97
+ racc (~> 1.4)
98
+ nokogiri (1.18.10-arm64-darwin)
99
+ racc (~> 1.4)
100
+ nokogiri (1.18.10-x86_64-darwin)
101
+ racc (~> 1.4)
102
+ nokogiri (1.18.10-x86_64-linux-gnu)
103
+ racc (~> 1.4)
104
+ nokogiri (1.18.10-x86_64-linux-musl)
105
+ racc (~> 1.4)
106
+ parallel (1.27.0)
107
+ parser (3.3.10.0)
108
+ ast (~> 2.4.1)
109
+ racc
110
+ pp (0.6.3)
111
+ prettyprint
112
+ prettyprint (0.2.0)
113
+ prism (1.6.0)
114
+ psych (5.2.6)
115
+ date
116
+ stringio
117
+ racc (1.8.1)
118
+ rack (3.2.4)
119
+ rack-proxy (0.7.7)
120
+ rack
121
+ rack-session (2.1.1)
122
+ base64 (>= 0.1.0)
123
+ rack (>= 3.0.0)
124
+ rack-test (2.2.0)
125
+ rack (>= 1.3)
126
+ rackup (2.2.1)
127
+ rack (>= 3)
128
+ rails-dom-testing (2.3.0)
129
+ activesupport (>= 5.0.0)
130
+ minitest
131
+ nokogiri (>= 1.6)
132
+ rails-html-sanitizer (1.6.2)
133
+ loofah (~> 2.21)
134
+ 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)
135
+ railties (8.1.1)
136
+ actionpack (= 8.1.1)
137
+ activesupport (= 8.1.1)
138
+ irb (~> 1.13)
139
+ rackup (>= 1.0.0)
140
+ rake (>= 12.2)
141
+ thor (~> 1.0, >= 1.2.2)
142
+ tsort (>= 0.2)
143
+ zeitwerk (~> 2.6)
144
+ rainbow (3.1.1)
145
+ rake (13.3.1)
146
+ rb-fsevent (0.11.2)
147
+ rb-inotify (0.11.1)
148
+ ffi (~> 1.0)
149
+ rdoc (6.16.1)
150
+ erb
151
+ psych (>= 4.0.0)
152
+ tsort
153
+ regexp_parser (2.11.3)
154
+ reline (0.6.3)
155
+ io-console (~> 0.5)
156
+ rspec (3.13.2)
157
+ rspec-core (~> 3.13.0)
158
+ rspec-expectations (~> 3.13.0)
159
+ rspec-mocks (~> 3.13.0)
160
+ rspec-core (3.13.6)
161
+ rspec-support (~> 3.13.0)
162
+ rspec-expectations (3.13.5)
163
+ diff-lcs (>= 1.2.0, < 2.0)
164
+ rspec-support (~> 3.13.0)
165
+ rspec-mocks (3.13.7)
166
+ diff-lcs (>= 1.2.0, < 2.0)
167
+ rspec-support (~> 3.13.0)
168
+ rspec-support (3.13.6)
169
+ rubocop (1.81.7)
170
+ json (~> 2.3)
171
+ language_server-protocol (~> 3.17.0.2)
172
+ lint_roller (~> 1.1.0)
173
+ parallel (~> 1.10)
174
+ parser (>= 3.3.0.2)
175
+ rainbow (>= 2.2.2, < 4.0)
176
+ regexp_parser (>= 2.9.3, < 3.0)
177
+ rubocop-ast (>= 1.47.1, < 2.0)
178
+ ruby-progressbar (~> 1.7)
179
+ unicode-display_width (>= 2.4.0, < 4.0)
180
+ rubocop-ast (1.48.0)
181
+ parser (>= 3.3.7.2)
182
+ prism (~> 1.4)
183
+ rubocop-performance (1.26.1)
184
+ lint_roller (~> 1.1)
185
+ rubocop (>= 1.75.0, < 2.0)
186
+ rubocop-ast (>= 1.47.1, < 2.0)
187
+ rubocop-rails (2.34.2)
188
+ activesupport (>= 4.2.0)
189
+ lint_roller (~> 1.1)
190
+ rack (>= 1.1)
191
+ rubocop (>= 1.75.0, < 2.0)
192
+ rubocop-ast (>= 1.44.0, < 2.0)
193
+ rubocop-rails-omakase (1.1.0)
194
+ rubocop (>= 1.72)
195
+ rubocop-performance (>= 1.24)
196
+ rubocop-rails (>= 2.30)
197
+ ruby-progressbar (1.13.0)
198
+ securerandom (0.4.1)
199
+ stimulus-rails (1.3.4)
200
+ railties (>= 6.0.0)
201
+ stringio (3.1.9)
202
+ thor (1.4.0)
203
+ tsort (0.2.0)
204
+ turbo-rails (2.0.20)
205
+ actionpack (>= 7.1.0)
206
+ railties (>= 7.1.0)
207
+ tzinfo (2.0.6)
208
+ concurrent-ruby (~> 1.0)
209
+ unicode-display_width (3.2.0)
210
+ unicode-emoji (~> 4.1)
211
+ unicode-emoji (4.1.0)
212
+ uri (1.1.1)
213
+ useragent (0.16.11)
214
+ vite_rails (3.0.19)
215
+ railties (>= 5.1, < 9)
216
+ vite_ruby (~> 3.0, >= 3.2.2)
217
+ vite_ruby (3.9.2)
218
+ dry-cli (>= 0.7, < 2)
219
+ logger (~> 1.6)
220
+ mutex_m
221
+ rack-proxy (~> 0.6, >= 0.6.1)
222
+ zeitwerk (~> 2.2)
223
+ zeitwerk (2.7.3)
224
+
225
+ PLATFORMS
226
+ aarch64-linux-gnu
227
+ aarch64-linux-musl
228
+ arm-linux-gnu
229
+ arm-linux-musl
230
+ arm64-darwin
231
+ x86_64-darwin
232
+ x86_64-linux-gnu
233
+ x86_64-linux-musl
234
+
235
+ DEPENDENCIES
236
+ appraisal (~> 2.5)
237
+ bundler (>= 2.4, < 3.0)
238
+ byebug
239
+ generator_spec (>= 0.9, < 1.0)
240
+ listen
241
+ rake (>= 13.0, < 14.0)
242
+ rspec (>= 3.12, < 4.0)
243
+ rubocop (>= 1.63, < 2.0)
244
+ rubocop-performance
245
+ rubocop-rails-omakase
246
+ stimulus-rails
247
+ sun-sword!
248
+ turbo-rails
249
+ vite_rails
250
+
251
+ BUNDLED WITH
252
+ 2.7.2
data/README.md CHANGED
@@ -1,10 +1,35 @@
1
1
  # SunSword
2
+ Rails generators for a **modern frontend stack**: Vite, Tailwind (v4), Hotwire (Turbo + Stimulus), plus view scaffolds aligned with your domain.
3
+
2
4
  This gem provides helper interfaces and classes to assist in the construction of application with
3
5
  Clean Architecture, as described in [Robert Martin's seminal book](https://www.amazon.com/gp/product/0134494164).
4
6
 
7
+ ---
8
+ ## ✨ Features
9
+
10
+ - **One-shot frontend setup**
11
+ Installs and wires **Vite**, **Tailwind v4**, **Turbo**, **Stimulus**, HMR, and sensible defaults using **Bun**.
12
+ - **Scaffolded views & components**
13
+ Opinionated but flexible ERB views, partials, and Stimulus controllers.
14
+ - **Clean integration with Rails 8 + Vite Ruby**
15
+ Ships `vite.config.ts`, `config/vite.json`, `Procfile.dev`, `bin/watch`, and entrypoints.
16
+ - **Fast package management with Bun**
17
+ All frontend dependencies (Vite, Tailwind, Turbo, Stimulus) are installed via Bun for maximum speed.
5
18
 
19
+ ---
6
20
  ## Installation
7
21
 
22
+ ### Prerequisites
23
+
24
+ Make sure you have **Bun** installed on your system:
25
+
26
+ ```bash
27
+ # Install Bun (if not already installed)
28
+ curl -fsSL https://bun.sh/install | bash
29
+ ```
30
+
31
+ ### Add to Gemfile
32
+
8
33
  Add this line to your application's Gemfile:
9
34
 
10
35
  ```ruby
@@ -12,32 +37,57 @@ gem 'rider-kick'
12
37
  gem 'sun-sword'
13
38
  ```
14
39
 
15
-
16
40
  And then execute:
17
41
  ```bash
18
- $ rails generate sun_sword:frontend
42
+ $ bundle install
43
+ $ rails generate sun_sword:frontend --setup
19
44
  $ rubocop -A
20
45
  ```
46
+
47
+ The generator will automatically install frontend dependencies using Bun.
48
+ ---
21
49
  ## Usage
50
+
51
+ ### Basic Usage
22
52
  ```bash
23
- Description:
24
- Clean Architecture CRUD generator
25
-
26
- Example:
27
- To Generate Frontend:
28
- bin/rails generate sun_sword:init
29
- bin/rails generate sun_sword:frontend --setup
30
-
31
- To Generate scaffold:
32
- bin/rails generate sun_sword:scaffold Models::Contact actor:user
33
- ```
53
+ # Init configuration
54
+ bin/rails generate sun_sword:init
55
+
56
+ # Setup frontend (main app only)
57
+ bin/rails generate sun_sword:frontend --setup
58
+
59
+ # Generate scaffold (main app)
60
+ bin/rails generate sun_sword:scaffold user
61
+ bin/rails generate sun_sword:scaffold product scope:dashboard
34
62
 
63
+ # Generate scaffold (specific engine)
64
+ bin/rails generate sun_sword:scaffold user --engine=admin
65
+
66
+ # Generate to one engine, use structure from another
67
+ bin/rails generate sun_sword:scaffold product --engine=api --engine_structure=core
68
+ ```
69
+ ---
70
+ ## Generated structure
71
+ ```text
72
+ app/
73
+ frontend/
74
+ entrypoints/
75
+ application.js
76
+ stimulus.js
77
+ pages/
78
+ web.js
79
+ stimulus.js
80
+ stylesheets/
81
+ application.css # Tailwind v4 style (@import, @plugin, @source)
82
+ assets/
83
+ ```
84
+ ---
35
85
  ## Philosophy
36
86
 
37
87
  The intention of this gem is to help you build applications that are built from the use case down,
38
88
  and decisions about I/O can be deferred until the last possible moment.
39
89
 
40
- ## Clean Architecture
90
+ ### Clean Architecture
41
91
  This structure provides helper interfaces and classes to assist in the construction of application with Clean Architecture, as described in Robert Martin's seminal book.
42
92
 
43
93
  ```
@@ -54,7 +104,7 @@ This structure provides helper interfaces and classes to assist in the construct
54
104
  - use_cases (Just Usecase)
55
105
  - utils (Class Reusable)
56
106
  ```
57
- ## Screaming architecture - use cases as an organisational principle
107
+ ### Screaming architecture - use cases as an organisational principle
58
108
  Uncle Bob suggests that your source code organisation should allow developers to easily find a listing of all use cases your application provides. Here's an example of how this might look in a this application.
59
109
  ```
60
110
  - app
@@ -82,4 +132,13 @@ Note that the use case name contains:
82
132
  # admin_fetch_info.rb [specific usecase]
83
133
  # fetch_info.rb [generic usecase] every role can access it
84
134
  ```
135
+ ---
136
+ ## Contributing
137
+
138
+ - Fork & bundle install
139
+ - ```bin/rails generate sun_sword:frontend --setup``` in a throwaway app to test changes
140
+ - Add/adjust generator tests where possible
141
+ - ```bundle exec rspec```
142
+ - Open a PR 🎉
85
143
 
144
+ See CONTRIBUTING.md for more.
data/Rakefile CHANGED
@@ -1,12 +1,8 @@
1
- # frozen_string_literal: true
1
+ # Rakefile
2
+ require 'rspec/core/rake_task'
2
3
 
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
4
+ RSpec::Core::RakeTask.new(:spec) do |t|
5
+ t.pattern = '{app,lib}/**/*_spec.rb'
6
+ end
5
7
 
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- require "rubocop/rake_task"
9
-
10
- RuboCop::RakeTask.new
11
-
12
- task default: %i[spec rubocop]
8
+ task default: :spec
@@ -1,10 +1,29 @@
1
1
  Description:
2
- Clean Architecture CRUD generator
3
- rails new jendral_jack -d=postgresql -T --skip-javascript --skip-asset-pipeline
2
+ Clean Architecture CRUD generator with Engine support (scaffold only)
3
+ rails new jendral_jack -d=postgresql -T --skip-javascript
4
4
 
5
5
  Example:
6
+ # Init configuration
6
7
  bin/rails generate sun_sword:init
8
+
9
+ # Frontend setup (main app only)
7
10
  bin/rails generate sun_sword:frontend --setup
8
- bin/rails generate sun_sword:scaffold contacts<check in db/structure>
9
11
 
12
+ # Scaffold (main app)
13
+ bin/rails generate sun_sword:scaffold contacts
14
+ bin/rails generate sun_sword:scaffold products scope:dashboard
15
+
16
+ # Scaffold (specific engine)
17
+ bin/rails generate sun_sword:scaffold users --engine=admin
18
+
19
+ # Scaffold (engine with structure from another engine)
20
+ bin/rails generate sun_sword:scaffold products --engine=api --engine_structure=core
21
+
22
+ Available Options:
23
+ --scope=SCOPE_NAME # Generate files in specific scope directory
24
+ --engine=ENGINE_NAME # Generate scaffold files to specific engine
25
+ --engine_structure=ENGINE # Load structure file from specific engine
26
+
27
+ Note: Structure files must be in db/structures/[name]_structure.yaml
28
+ For engines: [engine_path]/db/structures/[name]_structure.yaml
10
29