railsforge 1.0.2 → 2.1.0
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/README.md +129 -435
- data/lib/railsforge/analyzers/controller_analyzer.rb +29 -55
- data/lib/railsforge/analyzers/database_analyzer.rb +16 -30
- data/lib/railsforge/analyzers/metrics_analyzer.rb +8 -22
- data/lib/railsforge/analyzers/model_analyzer.rb +29 -46
- data/lib/railsforge/analyzers/performance_analyzer.rb +34 -94
- data/lib/railsforge/analyzers/refactor_analyzer.rb +77 -57
- data/lib/railsforge/analyzers/security_analyzer.rb +34 -91
- data/lib/railsforge/analyzers/spec_analyzer.rb +17 -31
- data/lib/railsforge/cli.rb +28 -645
- data/lib/railsforge/cli_minimal.rb +10 -55
- data/lib/railsforge/diff.rb +57 -0
- data/lib/railsforge/doctor.rb +52 -225
- data/lib/railsforge/formatter.rb +128 -0
- data/lib/railsforge/issue.rb +23 -0
- data/lib/railsforge/loader.rb +5 -64
- data/lib/railsforge/version.rb +1 -1
- metadata +15 -82
- data/lib/railsforge/api_generator.rb +0 -397
- data/lib/railsforge/audit.rb +0 -289
- data/lib/railsforge/config.rb +0 -181
- data/lib/railsforge/database_analyzer.rb +0 -300
- data/lib/railsforge/feature_generator.rb +0 -560
- data/lib/railsforge/generator.rb +0 -313
- data/lib/railsforge/generators/api_generator.rb +0 -392
- data/lib/railsforge/generators/base_generator.rb +0 -75
- data/lib/railsforge/generators/demo_generator.rb +0 -307
- data/lib/railsforge/generators/devops_generator.rb +0 -287
- data/lib/railsforge/generators/form_generator.rb +0 -180
- data/lib/railsforge/generators/job_generator.rb +0 -176
- data/lib/railsforge/generators/monitoring_generator.rb +0 -134
- data/lib/railsforge/generators/policy_generator.rb +0 -220
- data/lib/railsforge/generators/presenter_generator.rb +0 -173
- data/lib/railsforge/generators/query_generator.rb +0 -174
- data/lib/railsforge/generators/serializer_generator.rb +0 -166
- data/lib/railsforge/generators/service_generator.rb +0 -122
- data/lib/railsforge/generators/stimulus_controller_generator.rb +0 -129
- data/lib/railsforge/generators/test_generator.rb +0 -289
- data/lib/railsforge/generators/view_component_generator.rb +0 -169
- data/lib/railsforge/graph.rb +0 -270
- data/lib/railsforge/mailer_generator.rb +0 -191
- data/lib/railsforge/plugins/plugin_loader.rb +0 -60
- data/lib/railsforge/plugins.rb +0 -30
- data/lib/railsforge/profiles.rb +0 -99
- data/lib/railsforge/refactor_analyzer.rb +0 -401
- data/lib/railsforge/refactor_controller.rb +0 -277
- data/lib/railsforge/refactors/refactor_controller.rb +0 -117
- data/lib/railsforge/template_loader.rb +0 -105
- data/lib/railsforge/templates/v1/form/spec_template.rb +0 -18
- data/lib/railsforge/templates/v1/form/template.rb +0 -28
- data/lib/railsforge/templates/v1/job/spec_template.rb +0 -17
- data/lib/railsforge/templates/v1/job/template.rb +0 -13
- data/lib/railsforge/templates/v1/policy/spec_template.rb +0 -41
- data/lib/railsforge/templates/v1/policy/template.rb +0 -57
- data/lib/railsforge/templates/v1/presenter/spec_template.rb +0 -12
- data/lib/railsforge/templates/v1/presenter/template.rb +0 -13
- data/lib/railsforge/templates/v1/query/spec_template.rb +0 -12
- data/lib/railsforge/templates/v1/query/template.rb +0 -16
- data/lib/railsforge/templates/v1/serializer/spec_template.rb +0 -13
- data/lib/railsforge/templates/v1/serializer/template.rb +0 -11
- data/lib/railsforge/templates/v1/service/spec_template.rb +0 -12
- data/lib/railsforge/templates/v1/service/template.rb +0 -25
- data/lib/railsforge/templates/v1/stimulus_controller/template.rb +0 -35
- data/lib/railsforge/templates/v1/view_component/template.rb +0 -24
- data/lib/railsforge/templates/v2/job/template.rb +0 -49
- data/lib/railsforge/templates/v2/query/template.rb +0 -66
- data/lib/railsforge/templates/v2/service/spec_template.rb +0 -33
- data/lib/railsforge/templates/v2/service/template.rb +0 -71
- data/lib/railsforge/templates/v3/job/template.rb +0 -72
- data/lib/railsforge/templates/v3/query/spec_template.rb +0 -54
- data/lib/railsforge/templates/v3/query/template.rb +0 -115
- data/lib/railsforge/templates/v3/service/spec_template.rb +0 -51
- data/lib/railsforge/templates/v3/service/template.rb +0 -93
- data/lib/railsforge/wizard.rb +0 -265
- data/lib/railsforge/wizard_tui.rb +0 -286
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b004345e61120afc6f11432c72baeddb6981aee6e504d50b5eedf5b0334f71d6
|
|
4
|
+
data.tar.gz: 51bae87bc37e99da845f89ea3e9af014a2d9b6d85128417223978e5ffef14958
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1bc07580544ae7d06679dd03986cf6268b7598ead40a495a54ff8b2f8d0da1730871d01738ec419455998992f85cbda3619dbd60ccf77fb6ea73cce53ce7179c
|
|
7
|
+
data.tar.gz: 7b1b7c639d4da0968d6db7ea4e2a9d98a28398186f93ffeaddab9ee86c60c9481296d72ab64c0c9d552e795f635de3d146664e7cc6415d9c919db16bfe68aa18
|
data/README.md
CHANGED
|
@@ -12,513 +12,207 @@
|
|
|
12
12
|
</a>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
**Rails application health diagnostics.** Scans your codebase, surfaces structural issues, and tells you exactly what to fix.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
RailsForge streamlines Rails development by providing automated generators and analyzers for common tasks:
|
|
20
|
-
|
|
21
|
-
- **Monitoring Configuration** - Sentry error tracking and Lograge structured logging
|
|
22
|
-
- **DevOps Setup** - Docker containerization and CI/CD pipeline configuration
|
|
23
|
-
- **Security Analysis** - Automated vulnerability detection
|
|
24
|
-
- **Performance Analysis** - Performance optimization recommendations
|
|
25
|
-
- **Code Generation** - Services, queries, jobs, and more with template versioning
|
|
26
|
-
|
|
27
|
-
### Key Features
|
|
28
|
-
|
|
29
|
-
- 🔧 **Automated Generators** - Generate services, queries, jobs, components with a single command
|
|
30
|
-
- 📊 **Code Analyzers** - Security, performance, and architectural analysis
|
|
31
|
-
- 🐳 **DevOps Ready** - Docker and CI/CD configuration out of the box
|
|
32
|
-
- 📈 **Monitoring** - Sentry and Lograge integration
|
|
33
|
-
- 🎨 **Template System** - v1, v2, and v3 template versions with advanced patterns
|
|
34
|
-
- 🧩 **Plugin System** - Extensible architecture for custom functionality
|
|
35
|
-
- ⚙️ **Configuration** - Customizable via `.railsforgerc` YAML file
|
|
36
|
-
|
|
37
|
-
## Installation
|
|
38
|
-
|
|
39
|
-
### Requirements
|
|
17
|
+
---
|
|
40
18
|
|
|
41
|
-
|
|
42
|
-
- **Bundler** for gem management
|
|
19
|
+
## The Problem
|
|
43
20
|
|
|
44
|
-
|
|
21
|
+
Rails apps accumulate structural debt invisibly. Fat controllers, missing indexes, unguarded SQL, no specs for business-critical services — none of it surfaces until something breaks in production. By then the cost is high and the cause is buried.
|
|
45
22
|
|
|
46
|
-
|
|
23
|
+
Most teams only discover these problems during an audit, a security review, or an incident.
|
|
47
24
|
|
|
48
|
-
|
|
49
|
-
# Install the gem
|
|
50
|
-
gem install railsforge
|
|
51
|
-
|
|
52
|
-
# Verify installation
|
|
53
|
-
railsforge --version
|
|
54
|
-
```
|
|
25
|
+
---
|
|
55
26
|
|
|
56
|
-
|
|
27
|
+
## The Primary Command
|
|
57
28
|
|
|
58
29
|
```bash
|
|
59
|
-
|
|
60
|
-
git clone https://github.com/mfifth/railsforge.git
|
|
61
|
-
cd railsforge
|
|
62
|
-
|
|
63
|
-
# Install dependencies
|
|
64
|
-
bundle install
|
|
65
|
-
|
|
66
|
-
# Make the binary executable
|
|
67
|
-
chmod +x bin/railsforge
|
|
68
|
-
|
|
69
|
-
# Run locally
|
|
70
|
-
./bin/railsforge --version
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
#### Option 3: Add to Gemfile
|
|
74
|
-
|
|
75
|
-
```ruby
|
|
76
|
-
# Add to your Rails project's Gemfile
|
|
77
|
-
group :development do
|
|
78
|
-
gem 'railsforge', require: false
|
|
79
|
-
end
|
|
30
|
+
railsforge doctor
|
|
80
31
|
```
|
|
81
32
|
|
|
82
|
-
|
|
33
|
+
Runs a full diagnostic scan across your Rails app. Returns a health score and every detected issue, ranked by severity, with a concrete fix for each one.
|
|
83
34
|
|
|
84
|
-
|
|
85
|
-
bundle install
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Usage Documentation
|
|
35
|
+
---
|
|
89
36
|
|
|
90
|
-
|
|
37
|
+
## Example Output
|
|
91
38
|
|
|
92
|
-
```bash
|
|
93
|
-
railsforge --help
|
|
94
|
-
railsforge --version
|
|
95
39
|
```
|
|
40
|
+
RailsForge Health Report
|
|
41
|
+
─────────────────────────────��────────────────────
|
|
42
|
+
Score: 61/100
|
|
43
|
+
Issues: 9 total
|
|
96
44
|
|
|
97
|
-
|
|
45
|
+
HIGH (2)
|
|
46
|
+
[security]
|
|
47
|
+
app/controllers/users_controller.rb:42 — SQL Injection: User.where("name = '#{params[:name]}'")
|
|
48
|
+
→ Use parameterized queries: Model.where(column: value)
|
|
98
49
|
|
|
99
|
-
|
|
50
|
+
[performance]
|
|
51
|
+
app/controllers/posts_controller.rb:18 — N+1 Query: @posts.each do |post| post.comments.find
|
|
52
|
+
→ Use eager loading: includes(:association) or preload(:association)
|
|
100
53
|
|
|
101
|
-
|
|
54
|
+
MEDIUM (4)
|
|
55
|
+
[controller]
|
|
56
|
+
app/controllers/admin_controller.rb — AdminController has 214 lines (max 150)
|
|
57
|
+
→ Extract business logic to Service objects
|
|
102
58
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
railsforge generate monitoring --environment=production
|
|
107
|
-
```
|
|
59
|
+
[database]
|
|
60
|
+
db/schema.rb — Table `events` has datetime columns without an index
|
|
61
|
+
→ add_index :events, :created_at
|
|
108
62
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
- Updates environment configurations
|
|
63
|
+
[refactor]
|
|
64
|
+
app/models/user.rb — User has 267 lines (max 200)
|
|
65
|
+
→ Consider extracting concerns or service objects
|
|
113
66
|
|
|
114
|
-
|
|
67
|
+
app/models/order.rb — Method `process_payment` has 43 lines
|
|
68
|
+
→ Consider extracting to a private method or service
|
|
115
69
|
|
|
116
|
-
|
|
70
|
+
LOW (3)
|
|
71
|
+
[spec]
|
|
72
|
+
app/service/invoice_generator.rb — Service `invoice_generator` has no spec
|
|
73
|
+
→ Create spec/services/invoice_generator_spec.rb
|
|
117
74
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
railsforge generate devops --docker
|
|
121
|
-
railsforge generate devops --ci=github
|
|
122
|
-
railsforge generate devops --ci=gitlab
|
|
123
|
-
```
|
|
75
|
+
app/service/payment_processor.rb — Service `payment_processor` has no spec
|
|
76
|
+
→ Create spec/services/payment_processor_spec.rb
|
|
124
77
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- `.github/workflows/ci.yml` - GitHub Actions CI/CD
|
|
129
|
-
- `.gitlab-ci.yml` - GitLab CI configuration
|
|
130
|
-
- `config/kubernetes/` - Kubernetes manifests
|
|
131
|
-
- `bin/deploy` - Deployment script
|
|
132
|
-
|
|
133
|
-
#### Demo Project
|
|
134
|
-
|
|
135
|
-
Create a sample Rails project for learning or prototyping:
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
railsforge generate demo my_demo
|
|
139
|
-
railsforge generate demo my_demo --type=blog
|
|
140
|
-
railsforge generate demo my_api --type=api
|
|
78
|
+
[controller]
|
|
79
|
+
app/controllers/api/v1/orders_controller.rb — OrdersController has 13 methods (max 10)
|
|
80
|
+
→ Consider splitting into focused controllers
|
|
141
81
|
```
|
|
142
82
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Generate comprehensive test files:
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
railsforge generate test User
|
|
149
|
-
railsforge generate test PostsController --type=controller
|
|
150
|
-
railsforge generate test UserService --type=service
|
|
151
|
-
railsforge generate test SendEmailJob --type=job
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
#### Standard Generators
|
|
83
|
+
---
|
|
155
84
|
|
|
156
|
-
|
|
85
|
+
## JSON Mode
|
|
157
86
|
|
|
158
87
|
```bash
|
|
159
|
-
|
|
160
|
-
railsforge generate service user_creator
|
|
161
|
-
railsforge generate service user_creator --template=v2
|
|
162
|
-
railsforge generate service user_creator --template=v3
|
|
163
|
-
|
|
164
|
-
# Query objects
|
|
165
|
-
railsforge generate query active_users
|
|
166
|
-
railsforge generate query posts --template=v2
|
|
167
|
-
|
|
168
|
-
# Jobs
|
|
169
|
-
railsforge generate job send_email
|
|
170
|
-
railsforge generate job process_data --template=v3
|
|
171
|
-
|
|
172
|
-
# Form objects
|
|
173
|
-
railsforge generate form contact_form
|
|
174
|
-
|
|
175
|
-
# Presenters
|
|
176
|
-
railsforge generate presenter user_presenter
|
|
177
|
-
|
|
178
|
-
# Policies
|
|
179
|
-
railsforge generate policy post_policy
|
|
180
|
-
|
|
181
|
-
# Serializers
|
|
182
|
-
railsforge generate serializer post_serializer
|
|
183
|
-
|
|
184
|
-
# View Components
|
|
185
|
-
railsforge generate component button
|
|
186
|
-
railsforge generate component modal --template=v2
|
|
187
|
-
|
|
188
|
-
# Stimulus Controllers
|
|
189
|
-
railsforge generate stimulus dropdown
|
|
190
|
-
|
|
191
|
-
# Mailers
|
|
192
|
-
railsforge generate mailer user_mailer
|
|
193
|
-
|
|
194
|
-
# Features
|
|
195
|
-
railsforge generate feature user_signup
|
|
196
|
-
|
|
197
|
-
# API Resources
|
|
198
|
-
railsforge generate api posts
|
|
88
|
+
railsforge doctor --format=json
|
|
199
89
|
```
|
|
200
90
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
#### Security Analysis
|
|
91
|
+
Returns structured output for CI pipelines and automated tooling:
|
|
204
92
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"score": 61,
|
|
96
|
+
"issues": [
|
|
97
|
+
{
|
|
98
|
+
"analyzer": "security",
|
|
99
|
+
"type": "sql_injection",
|
|
100
|
+
"severity": "high",
|
|
101
|
+
"file": "app/controllers/users_controller.rb",
|
|
102
|
+
"line": 42,
|
|
103
|
+
"message": "SQL Injection: User.where(\"name = '#{params[:name]}'\")",
|
|
104
|
+
"suggestion": "Use parameterized queries: Model.where(column: value)"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"summary": {
|
|
108
|
+
"total": 9,
|
|
109
|
+
"by_severity": {
|
|
110
|
+
"critical": 0,
|
|
111
|
+
"high": 2,
|
|
112
|
+
"medium": 4,
|
|
113
|
+
"low": 3,
|
|
114
|
+
"info": 0
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
210
118
|
```
|
|
211
119
|
|
|
212
|
-
|
|
213
|
-
- SQL injection vulnerabilities
|
|
214
|
-
- Cross-site scripting (XSS) risks
|
|
215
|
-
- Authentication/authorization issues
|
|
216
|
-
- Insecure configuration patterns
|
|
217
|
-
- Sensitive data exposure
|
|
218
|
-
|
|
219
|
-
#### Performance Analysis
|
|
120
|
+
All five severity keys are always present, even when zero. Score is always an integer. Output is deterministic.
|
|
220
121
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
```bash
|
|
224
|
-
railsforge analyze performance
|
|
225
|
-
railsforge analyze performance --verbose
|
|
226
|
-
```
|
|
122
|
+
---
|
|
227
123
|
|
|
228
|
-
|
|
229
|
-
- N+1 query patterns
|
|
230
|
-
- Missing database indexes
|
|
231
|
-
- Inefficient queries
|
|
232
|
-
- Memory leak patterns
|
|
233
|
-
- Unoptimized asset loading
|
|
124
|
+
## CI Usage
|
|
234
125
|
|
|
235
|
-
|
|
126
|
+
RailsForge provides signal. CI decides consequences.
|
|
236
127
|
|
|
237
128
|
```bash
|
|
238
|
-
|
|
239
|
-
railsforge analyze controllers
|
|
240
|
-
railsforge analyze c
|
|
241
|
-
|
|
242
|
-
# Analyze models
|
|
243
|
-
railsforge analyze models
|
|
244
|
-
railsforge analyze m
|
|
245
|
-
|
|
246
|
-
# Analyze specs
|
|
247
|
-
railsforge analyze specs
|
|
248
|
-
railsforge analyze spec
|
|
249
|
-
|
|
250
|
-
# Analyze database
|
|
251
|
-
railsforge analyze db
|
|
252
|
-
railsforge analyze database
|
|
253
|
-
|
|
254
|
-
# Analyze metrics
|
|
255
|
-
railsforge analyze metrics
|
|
256
|
-
|
|
257
|
-
# Run all analyzers
|
|
258
|
-
railsforge analyze all
|
|
259
|
-
railsforge analyze full
|
|
129
|
+
railsforge doctor --format=json | jq '.score'
|
|
260
130
|
```
|
|
261
131
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
#### Doctor - Health Check
|
|
265
|
-
|
|
266
|
-
Comprehensive project health report:
|
|
267
|
-
|
|
268
|
-
```bash
|
|
269
|
-
railsforge doctor
|
|
270
|
-
```
|
|
132
|
+
RailsForge always exits `0` on a successful run. Your CI script owns the pass/fail logic.
|
|
271
133
|
|
|
272
|
-
|
|
134
|
+
### GitHub Actions
|
|
273
135
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
Generate a Graphviz diagram of your Rails architecture:
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
railsforge graph
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
Outputs `.dot` and `.svg` files to `tmp/railsforge/`.
|
|
136
|
+
```yaml
|
|
137
|
+
name: RailsForge Health Check
|
|
283
138
|
|
|
284
|
-
|
|
139
|
+
on: [push, pull_request]
|
|
285
140
|
|
|
286
|
-
|
|
141
|
+
jobs:
|
|
142
|
+
railsforge:
|
|
143
|
+
runs-on: ubuntu-latest
|
|
287
144
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
railsforge wizard --profile=blog
|
|
291
|
-
```
|
|
145
|
+
steps:
|
|
146
|
+
- uses: actions/checkout@v3
|
|
292
147
|
|
|
293
|
-
|
|
148
|
+
- name: Setup Ruby
|
|
149
|
+
uses: ruby/setup-ruby@v1
|
|
150
|
+
with:
|
|
151
|
+
ruby-version: 3.2
|
|
294
152
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
railsforge plugins list
|
|
153
|
+
- name: Install RailsForge
|
|
154
|
+
run: gem install railsforge
|
|
298
155
|
|
|
299
|
-
|
|
300
|
-
|
|
156
|
+
- name: Run RailsForge
|
|
157
|
+
run: |
|
|
158
|
+
score=$(railsforge doctor --format=json | jq '.score')
|
|
159
|
+
echo "Score: $score"
|
|
160
|
+
if [ "$score" -lt 80 ]; then
|
|
161
|
+
echo "RailsForge score below threshold"
|
|
162
|
+
exit 1
|
|
163
|
+
fi
|
|
301
164
|
```
|
|
302
165
|
|
|
303
|
-
|
|
166
|
+
---
|
|
304
167
|
|
|
305
|
-
|
|
306
|
-
# View current configuration
|
|
307
|
-
railsforge config
|
|
168
|
+
## What RailsForge Detects
|
|
308
169
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
170
|
+
- **Security** — SQL injection, XSS, weak cryptography, sensitive data exposure
|
|
171
|
+
- **Performance** — N+1 queries, missing database indexes, inefficient query patterns
|
|
172
|
+
- **Architecture** — Fat controllers, fat models, methods that exceed complexity thresholds
|
|
173
|
+
- **Test coverage** — Service objects, queries, jobs, policies with no corresponding spec
|
|
174
|
+
- **Refactoring opportunities** — Long methods, oversized files
|
|
313
175
|
|
|
314
|
-
|
|
176
|
+
---
|
|
315
177
|
|
|
316
|
-
|
|
178
|
+
## Installation
|
|
317
179
|
|
|
318
180
|
```bash
|
|
319
|
-
railsforge
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
Available profiles: blog, admin_app, api_only, standard
|
|
323
|
-
|
|
324
|
-
## Configuration Options
|
|
325
|
-
|
|
326
|
-
### .railsforgerc
|
|
327
|
-
|
|
328
|
-
Create a `.railsforgerc` file in your project root to customize RailsForge behavior:
|
|
329
|
-
|
|
330
|
-
```yaml
|
|
331
|
-
# .railsforgerc
|
|
332
|
-
default_template: v2
|
|
333
|
-
analyzer_threshold: 10
|
|
334
|
-
|
|
335
|
-
# Generator settings
|
|
336
|
-
generators:
|
|
337
|
-
with_specs: true
|
|
338
|
-
template_version: v2
|
|
339
|
-
|
|
340
|
-
# Analyzer settings
|
|
341
|
-
security:
|
|
342
|
-
strict_mode: true
|
|
343
|
-
performance:
|
|
344
|
-
check_n_plus_queries: true
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
### Available Flags
|
|
348
|
-
|
|
349
|
-
| Flag | Description | Default |
|
|
350
|
-
|------|-------------|---------|
|
|
351
|
-
| `--sentry_dsn` | Sentry DSN for error tracking | - |
|
|
352
|
-
| `--environment` | Rails environment | development |
|
|
353
|
-
| `--template` | Template version (v1, v2, v3) | v1 |
|
|
354
|
-
| `--dry-run` | Preview changes without executing | false |
|
|
355
|
-
| `--no-spec` | Generate without spec files | false |
|
|
356
|
-
|
|
357
|
-
## Template System
|
|
358
|
-
|
|
359
|
-
RailsForge supports multiple template versions for each component:
|
|
360
|
-
|
|
361
|
-
### v1 - Standard Templates
|
|
362
|
-
|
|
363
|
-
Basic templates suitable for simple applications:
|
|
364
|
-
|
|
365
|
-
```ruby
|
|
366
|
-
class UserCreator
|
|
367
|
-
def initialize(params)
|
|
368
|
-
@params = params
|
|
369
|
-
end
|
|
370
|
-
|
|
371
|
-
def call
|
|
372
|
-
# Basic implementation
|
|
373
|
-
end
|
|
374
|
-
end
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### v2 - Enhanced Templates
|
|
378
|
-
|
|
379
|
-
Enhanced templates with additional features:
|
|
380
|
-
|
|
381
|
-
```ruby
|
|
382
|
-
class UserCreator < BaseService
|
|
383
|
-
option :name
|
|
384
|
-
|
|
385
|
-
def call
|
|
386
|
-
# Enhanced with Dry::Schema validation
|
|
387
|
-
end
|
|
388
|
-
end
|
|
181
|
+
gem install railsforge
|
|
389
182
|
```
|
|
390
183
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
Advanced templates with best practices:
|
|
184
|
+
Or in your `Gemfile`:
|
|
394
185
|
|
|
395
186
|
```ruby
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
def call
|
|
400
|
-
yield validate!
|
|
401
|
-
yield process!
|
|
402
|
-
Success(result_data)
|
|
403
|
-
end
|
|
187
|
+
group :development do
|
|
188
|
+
gem 'railsforge', require: false
|
|
404
189
|
end
|
|
405
190
|
```
|
|
406
191
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
### Complete Workflow Example
|
|
410
|
-
|
|
411
|
-
```bash
|
|
412
|
-
# 1. Create a new Rails app (optional)
|
|
413
|
-
railsforge new my_app --profile=api
|
|
414
|
-
|
|
415
|
-
# 2. Add monitoring
|
|
416
|
-
cd my_app
|
|
417
|
-
railsforge generate monitoring --sentry_dsn=https://key@sentry.io/123
|
|
418
|
-
|
|
419
|
-
# 3. Add DevOps setup
|
|
420
|
-
railsforge generate devops --ci=github
|
|
421
|
-
|
|
422
|
-
# 4. Generate components
|
|
423
|
-
railsforge generate service user_creator --template=v3
|
|
424
|
-
railsforge generate job send_welcome_email --template=v3
|
|
425
|
-
railsforge generate query active_users --template=v3
|
|
426
|
-
|
|
427
|
-
# 5. Run analysis
|
|
428
|
-
railsforge analyze all
|
|
429
|
-
railsforge doctor
|
|
430
|
-
|
|
431
|
-
# 6. Check architecture
|
|
432
|
-
railsforge graph
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
### Output Examples
|
|
436
|
-
|
|
437
|
-
```
|
|
438
|
-
$ railsforge generate monitoring
|
|
439
|
-
Generating Monitoring configurations...
|
|
440
|
-
Created config/initializers/sentry.rb
|
|
441
|
-
Created config/initializers/lograge.rb
|
|
442
|
-
Updated production.rb
|
|
443
|
-
|
|
444
|
-
$ railsforge analyze security
|
|
445
|
-
Security Analysis
|
|
446
|
-
==================================================
|
|
447
|
-
✓ No security issues found
|
|
448
|
-
|
|
449
|
-
$ railsforge analyze performance
|
|
450
|
-
Performance Analysis
|
|
451
|
-
==================================================
|
|
452
|
-
✓ No performance issues found
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
## Contributing
|
|
456
|
-
|
|
457
|
-
We welcome contributions! Please see our contributing guidelines:
|
|
192
|
+
Requires Ruby 3.0+.
|
|
458
193
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
```bash
|
|
462
|
-
# Fork the repository
|
|
463
|
-
git clone https://github.com/mfifth/RailsForge.git
|
|
464
|
-
cd railsforge
|
|
194
|
+
---
|
|
465
195
|
|
|
466
|
-
|
|
467
|
-
bundle install
|
|
196
|
+
## Configuration
|
|
468
197
|
|
|
469
|
-
|
|
470
|
-
bundle exec rake test
|
|
198
|
+
Optional `.railsforgerc` in your project root:
|
|
471
199
|
|
|
472
|
-
|
|
473
|
-
|
|
200
|
+
```yaml
|
|
201
|
+
analyzers:
|
|
202
|
+
controller_max_lines: 150
|
|
203
|
+
controller_max_methods: 10
|
|
204
|
+
model_max_lines: 200
|
|
205
|
+
model_max_method_lines: 15
|
|
474
206
|
```
|
|
475
207
|
|
|
476
|
-
|
|
208
|
+
---
|
|
477
209
|
|
|
478
|
-
|
|
479
|
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
480
|
-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
481
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
482
|
-
5. Open a Pull Request
|
|
210
|
+
## Philosophy
|
|
483
211
|
|
|
484
|
-
|
|
212
|
+
Analyze reality. Don't prescribe structure.
|
|
485
213
|
|
|
486
|
-
|
|
487
|
-
- Write tests for new features
|
|
488
|
-
- Update documentation for any changes
|
|
489
|
-
- Use meaningful commit messages
|
|
214
|
+
---
|
|
490
215
|
|
|
491
216
|
## License
|
|
492
217
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
Copyright (c) 2024 RailsForge Contributors
|
|
496
|
-
|
|
497
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
498
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
499
|
-
in the Software without restriction, including without limitation the rights
|
|
500
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
501
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
502
|
-
furnished to do so, subject to the following conditions:
|
|
503
|
-
|
|
504
|
-
The above copyright notice and this permission notice shall be included in all
|
|
505
|
-
copies or substantial portions of the Software.
|
|
506
|
-
|
|
507
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
508
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
509
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
510
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
511
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
512
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
513
|
-
SOFTWARE.
|
|
514
|
-
|
|
515
|
-
## Support
|
|
516
|
-
|
|
517
|
-
- 📖 [Documentation](https://github.com/railsforge/railsforge/wiki)
|
|
518
|
-
- 🐛 [Issue Tracker](https://github.com/railsforge/railsforge/issues)
|
|
519
|
-
- 💬 [Discussions](https://github.com/railsforge/railsforge/discussions)
|
|
520
|
-
- ⭐ [Give us a star](https://github.com/railsforge/railsforge)
|
|
521
|
-
|
|
522
|
-
---
|
|
523
|
-
|
|
524
|
-
<p align="center">Built with ❤️ for the Rails community</p>
|
|
218
|
+
MIT
|