railsforge 1.0.1 → 2.0.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 +105 -444
- 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 +14 -636
- data/lib/railsforge/cli_minimal.rb +8 -55
- data/lib/railsforge/doctor.rb +52 -225
- data/lib/railsforge/formatter.rb +102 -0
- data/lib/railsforge/issue.rb +23 -0
- data/lib/railsforge/loader.rb +5 -54
- data/lib/railsforge/version.rb +1 -1
- metadata +16 -77
- 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/base_generator.rb +0 -70
- data/lib/railsforge/generators/demo_generator.rb +0 -307
- data/lib/railsforge/generators/devops_generator.rb +0 -287
- data/lib/railsforge/generators/monitoring_generator.rb +0 -134
- 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: 2c8f6efda41c0957fd4a4675fbd5e310fb825c2a26001c4e5af5abb02af97347
|
|
4
|
+
data.tar.gz: 91f9e9baf1d073a0bbe8cd7db41972504183281bc27945aaee77185f02229718
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb84ad0cbdbdd3b154c3e4b4dbeb6acbe909f5d67fa8511b2002dccd18756436531e33d508e247335a5ed2603fc5b6654b84136cc2c73d1e75bd3308e797e6f4
|
|
7
|
+
data.tar.gz: 2705a473ed8ae7323f5800c75e7a5ecb0a077ff07beef6707e830c409d24737a02ce2310241b421127f2ff9cb64bbd583096599a2291c6762246c2077f29bfaf
|
data/README.md
CHANGED
|
@@ -12,513 +12,174 @@
|
|
|
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
|
|
40
|
-
|
|
41
|
-
- **Ruby** version 3.0 or higher
|
|
42
|
-
- **Bundler** for gem management
|
|
43
|
-
|
|
44
|
-
### Setup Steps
|
|
45
|
-
|
|
46
|
-
#### Option 1: Install from RubyGems (Recommended)
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
# Install the gem
|
|
50
|
-
gem install railsforge
|
|
51
|
-
|
|
52
|
-
# Verify installation
|
|
53
|
-
railsforge --version
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
#### Option 2: Install from Source
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
# Clone the repository
|
|
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
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Then run:
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
bundle install
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Usage Documentation
|
|
89
|
-
|
|
90
|
-
### Getting Help
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
railsforge --help
|
|
94
|
-
railsforge --version
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Generate Commands
|
|
17
|
+
---
|
|
98
18
|
|
|
99
|
-
|
|
19
|
+
## The Problem
|
|
100
20
|
|
|
101
|
-
|
|
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.
|
|
102
22
|
|
|
103
|
-
|
|
104
|
-
railsforge generate monitoring
|
|
105
|
-
railsforge generate monitoring --sentry_dsn=your_dsn_here
|
|
106
|
-
railsforge generate monitoring --environment=production
|
|
107
|
-
```
|
|
23
|
+
Most teams only discover these problems during an audit, a security review, or an incident.
|
|
108
24
|
|
|
109
|
-
|
|
110
|
-
- `config/initializers/sentry.rb` - Sentry configuration
|
|
111
|
-
- `config/initializers/lograge.rb` - Lograge setup
|
|
112
|
-
- Updates environment configurations
|
|
113
|
-
|
|
114
|
-
#### DevOps Configuration
|
|
25
|
+
---
|
|
115
26
|
|
|
116
|
-
|
|
27
|
+
## The Primary Command
|
|
117
28
|
|
|
118
29
|
```bash
|
|
119
|
-
railsforge
|
|
120
|
-
railsforge generate devops --docker
|
|
121
|
-
railsforge generate devops --ci=github
|
|
122
|
-
railsforge generate devops --ci=gitlab
|
|
30
|
+
railsforge doctor
|
|
123
31
|
```
|
|
124
32
|
|
|
125
|
-
|
|
126
|
-
- `Dockerfile` - Container definition
|
|
127
|
-
- `docker-compose.yml` - Multi-service setup
|
|
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:
|
|
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.
|
|
136
34
|
|
|
137
|
-
|
|
138
|
-
railsforge generate demo my_demo
|
|
139
|
-
railsforge generate demo my_demo --type=blog
|
|
140
|
-
railsforge generate demo my_api --type=api
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
#### Test Files
|
|
35
|
+
---
|
|
144
36
|
|
|
145
|
-
|
|
37
|
+
## Example Output
|
|
146
38
|
|
|
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
39
|
```
|
|
40
|
+
RailsForge Health Report
|
|
41
|
+
─────────────────────────────��────────────────────
|
|
42
|
+
Score: 61/100
|
|
43
|
+
Issues: 9 total
|
|
153
44
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
# Service objects
|
|
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
|
|
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)
|
|
174
49
|
|
|
175
|
-
|
|
176
|
-
|
|
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)
|
|
177
53
|
|
|
178
|
-
|
|
179
|
-
|
|
54
|
+
MEDIUM (4)
|
|
55
|
+
[controller]
|
|
56
|
+
app/controllers/admin_controller.rb — AdminController has 214 lines (max 150)
|
|
57
|
+
→ Extract business logic to Service objects
|
|
180
58
|
|
|
181
|
-
|
|
182
|
-
|
|
59
|
+
[database]
|
|
60
|
+
db/schema.rb — Table `events` has datetime columns without an index
|
|
61
|
+
→ add_index :events, :created_at
|
|
183
62
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
63
|
+
[refactor]
|
|
64
|
+
app/models/user.rb — User has 267 lines (max 200)
|
|
65
|
+
→ Consider extracting concerns or service objects
|
|
187
66
|
|
|
188
|
-
|
|
189
|
-
|
|
67
|
+
app/models/order.rb — Method `process_payment` has 43 lines
|
|
68
|
+
→ Consider extracting to a private method or service
|
|
190
69
|
|
|
191
|
-
|
|
192
|
-
|
|
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
|
|
193
74
|
|
|
194
|
-
|
|
195
|
-
|
|
75
|
+
app/service/payment_processor.rb — Service `payment_processor` has no spec
|
|
76
|
+
→ Create spec/services/payment_processor_spec.rb
|
|
196
77
|
|
|
197
|
-
|
|
198
|
-
|
|
78
|
+
[controller]
|
|
79
|
+
app/controllers/api/v1/orders_controller.rb — OrdersController has 13 methods (max 10)
|
|
80
|
+
→ Consider splitting into focused controllers
|
|
199
81
|
```
|
|
200
82
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
#### Security Analysis
|
|
83
|
+
---
|
|
204
84
|
|
|
205
|
-
|
|
85
|
+
## JSON Mode
|
|
206
86
|
|
|
207
87
|
```bash
|
|
208
|
-
railsforge
|
|
209
|
-
railsforge analyze security --verbose
|
|
88
|
+
railsforge doctor --format=json
|
|
210
89
|
```
|
|
211
90
|
|
|
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
|
|
91
|
+
Returns structured output for CI pipelines and automated tooling:
|
|
220
92
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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
|
+
"high": 2,
|
|
111
|
+
"medium": 4,
|
|
112
|
+
"low": 3
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
226
116
|
```
|
|
227
117
|
|
|
228
|
-
|
|
229
|
-
- N+1 query patterns
|
|
230
|
-
- Missing database indexes
|
|
231
|
-
- Inefficient queries
|
|
232
|
-
- Memory leak patterns
|
|
233
|
-
- Unoptimized asset loading
|
|
234
|
-
|
|
235
|
-
#### Other Analyzers
|
|
118
|
+
**Fail a CI build when score drops below threshold:**
|
|
236
119
|
|
|
237
120
|
```bash
|
|
238
|
-
|
|
239
|
-
|
|
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
|
|
121
|
+
score=$(railsforge doctor --format=json | jq '.score')
|
|
122
|
+
[ "$score" -ge 70 ] || exit 1
|
|
260
123
|
```
|
|
261
124
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
#### Doctor - Health Check
|
|
265
|
-
|
|
266
|
-
Comprehensive project health report:
|
|
267
|
-
|
|
268
|
-
```bash
|
|
269
|
-
railsforge doctor
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
Combines all analyzers and calculates an architecture score (0-100).
|
|
273
|
-
|
|
274
|
-
#### Dependency Graph
|
|
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/`.
|
|
283
|
-
|
|
284
|
-
#### Wizard - Interactive Setup
|
|
285
|
-
|
|
286
|
-
Interactive project configuration:
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
railsforge wizard
|
|
290
|
-
railsforge wizard --profile=blog
|
|
291
|
-
```
|
|
125
|
+
---
|
|
292
126
|
|
|
293
|
-
|
|
127
|
+
## What RailsForge Detects
|
|
294
128
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
129
|
+
- **Security** — SQL injection, XSS, weak cryptography, sensitive data exposure
|
|
130
|
+
- **Performance** — N+1 queries, missing database indexes, inefficient query patterns
|
|
131
|
+
- **Architecture** — Fat controllers, fat models, methods that exceed complexity thresholds
|
|
132
|
+
- **Test coverage** — Service objects, queries, jobs, policies with no corresponding spec
|
|
133
|
+
- **Refactoring opportunities** — Long methods, oversized files
|
|
298
134
|
|
|
299
|
-
|
|
300
|
-
railsforge plugins load my_plugin
|
|
301
|
-
```
|
|
135
|
+
---
|
|
302
136
|
|
|
303
|
-
|
|
137
|
+
## What RailsForge Is Not
|
|
304
138
|
|
|
305
|
-
|
|
306
|
-
# View current configuration
|
|
307
|
-
railsforge config
|
|
139
|
+
RailsForge is not a generator, scaffolding system, or DevOps platform.
|
|
308
140
|
|
|
309
|
-
|
|
310
|
-
railsforge config set default_template v2
|
|
311
|
-
railsforge config set analyzer_threshold 10
|
|
312
|
-
```
|
|
141
|
+
It does not create architecture. It diagnoses existing architecture.
|
|
313
142
|
|
|
314
|
-
|
|
143
|
+
---
|
|
315
144
|
|
|
316
|
-
|
|
145
|
+
## Installation
|
|
317
146
|
|
|
318
147
|
```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
|
|
148
|
+
gem install railsforge
|
|
389
149
|
```
|
|
390
150
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
Advanced templates with best practices:
|
|
151
|
+
Or in your `Gemfile`:
|
|
394
152
|
|
|
395
153
|
```ruby
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
def call
|
|
400
|
-
yield validate!
|
|
401
|
-
yield process!
|
|
402
|
-
Success(result_data)
|
|
403
|
-
end
|
|
154
|
+
group :development do
|
|
155
|
+
gem 'railsforge', require: false
|
|
404
156
|
end
|
|
405
157
|
```
|
|
406
158
|
|
|
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:
|
|
458
|
-
|
|
459
|
-
### Development Setup
|
|
159
|
+
Requires Ruby 3.0+.
|
|
460
160
|
|
|
461
|
-
|
|
462
|
-
# Fork the repository
|
|
463
|
-
git clone https://github.com/mfifth/RailsForge.git
|
|
464
|
-
cd railsforge
|
|
161
|
+
---
|
|
465
162
|
|
|
466
|
-
|
|
467
|
-
bundle install
|
|
163
|
+
## Configuration
|
|
468
164
|
|
|
469
|
-
|
|
470
|
-
bundle exec rake test
|
|
165
|
+
Optional `.railsforgerc` in your project root:
|
|
471
166
|
|
|
472
|
-
|
|
473
|
-
|
|
167
|
+
```yaml
|
|
168
|
+
analyzers:
|
|
169
|
+
controller_max_lines: 150
|
|
170
|
+
controller_max_methods: 10
|
|
171
|
+
model_max_lines: 200
|
|
172
|
+
model_max_method_lines: 15
|
|
474
173
|
```
|
|
475
174
|
|
|
476
|
-
|
|
175
|
+
---
|
|
477
176
|
|
|
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
|
|
177
|
+
## Philosophy
|
|
483
178
|
|
|
484
|
-
|
|
179
|
+
Analyze reality. Don't prescribe structure.
|
|
485
180
|
|
|
486
|
-
|
|
487
|
-
- Write tests for new features
|
|
488
|
-
- Update documentation for any changes
|
|
489
|
-
- Use meaningful commit messages
|
|
181
|
+
---
|
|
490
182
|
|
|
491
183
|
## License
|
|
492
184
|
|
|
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>
|
|
185
|
+
MIT
|