rails-flow-map 0.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 +7 -0
- data/CHANGELOG.md +52 -0
- data/LICENSE +21 -0
- data/README.md +314 -0
- data/README_ja.md +314 -0
- data/README_zh.md +314 -0
- data/lib/rails_flow_map/analyzers/controller_analyzer.rb +124 -0
- data/lib/rails_flow_map/analyzers/model_analyzer.rb +139 -0
- data/lib/rails_flow_map/configuration.rb +22 -0
- data/lib/rails_flow_map/engine.rb +16 -0
- data/lib/rails_flow_map/errors.rb +240 -0
- data/lib/rails_flow_map/formatters/d3js_formatter.rb +488 -0
- data/lib/rails_flow_map/formatters/erd_formatter.rb +64 -0
- data/lib/rails_flow_map/formatters/git_diff_formatter.rb +589 -0
- data/lib/rails_flow_map/formatters/graphviz_formatter.rb +111 -0
- data/lib/rails_flow_map/formatters/mermaid_formatter.rb +91 -0
- data/lib/rails_flow_map/formatters/metrics_formatter.rb +196 -0
- data/lib/rails_flow_map/formatters/openapi_formatter.rb +557 -0
- data/lib/rails_flow_map/formatters/plantuml_formatter.rb +92 -0
- data/lib/rails_flow_map/formatters/sequence_formatter.rb +288 -0
- data/lib/rails_flow_map/generators/install/templates/rails_flow_map.rb +34 -0
- data/lib/rails_flow_map/generators/install_generator.rb +32 -0
- data/lib/rails_flow_map/logging.rb +215 -0
- data/lib/rails_flow_map/models/flow_edge.rb +31 -0
- data/lib/rails_flow_map/models/flow_graph.rb +58 -0
- data/lib/rails_flow_map/models/flow_node.rb +37 -0
- data/lib/rails_flow_map/version.rb +3 -0
- data/lib/rails_flow_map.rb +310 -0
- data/lib/tasks/rails_flow_map.rake +70 -0
- metadata +156 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f78da594cc75cdfdb7e606ab9eab72645b6a0752f6ff7096728ac7f3c86cd7d8
|
4
|
+
data.tar.gz: e479a8b273c9a1edda38170e91ae4638ecae27f74cfe33eb40f58464d6f6a777
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 265c5fb6f05374d7c03d1019b98657714de4235aeaaca08a942cb0ff9adcb215c84b7b623ace2e0d13eddaf151c458e2e9865273cd7c0ca4996493ceb63ba221
|
7
|
+
data.tar.gz: 86619f1eeffea1277cf4ff4cfcddb73ab983b91658a77a19d26cb3bf1405ca7f73eb7bbb3e039e6459f54ab586944ad8867f963d252359d344ac8a1f089cdeb8
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,52 @@
|
|
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
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
## [0.1.0] - 2024-07-12
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- Initial release of Rails Flow Map
|
14
|
+
- Support for multiple visualization formats:
|
15
|
+
- Mermaid diagrams (GitHub-friendly)
|
16
|
+
- PlantUML class diagrams
|
17
|
+
- GraphViz network diagrams
|
18
|
+
- Interactive D3.js visualizations
|
19
|
+
- OpenAPI specifications
|
20
|
+
- Sequence diagrams
|
21
|
+
- ERD diagrams
|
22
|
+
- Metrics reports
|
23
|
+
- Git diff visualizations
|
24
|
+
- Enterprise-grade security features:
|
25
|
+
- Path traversal protection
|
26
|
+
- XSS prevention
|
27
|
+
- Input validation
|
28
|
+
- Security event logging
|
29
|
+
- Performance and reliability:
|
30
|
+
- Structured logging with performance metrics
|
31
|
+
- Robust error handling with context
|
32
|
+
- Retry logic for transient failures
|
33
|
+
- Memory optimization for large applications
|
34
|
+
- Developer experience:
|
35
|
+
- Zero configuration setup
|
36
|
+
- Rake tasks integration
|
37
|
+
- VS Code task definitions
|
38
|
+
- Comprehensive documentation
|
39
|
+
- Rail Engine integration
|
40
|
+
- Configurable analysis options
|
41
|
+
- Comprehensive test suite with security tests
|
42
|
+
- YARD documentation for all public APIs
|
43
|
+
- Usage examples and quick reference guides
|
44
|
+
- Multi-language documentation (English, Japanese, Chinese)
|
45
|
+
|
46
|
+
### Dependencies
|
47
|
+
- Ruby >= 2.7.0
|
48
|
+
- Rails >= 6.0
|
49
|
+
- parser gem for AST analysis
|
50
|
+
|
51
|
+
[Unreleased]: https://github.com/railsflowmap/rails-flow-map/compare/v0.1.0...HEAD
|
52
|
+
[0.1.0]: https://github.com/railsflowmap/rails-flow-map/releases/tag/v0.1.0
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Rails Flow Map Team
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,314 @@
|
|
1
|
+
# Rails Flow Map 🚀
|
2
|
+
|
3
|
+
[](https://github.com/railsflowmap/rails-flow-map)
|
4
|
+
[](LICENSE)
|
5
|
+
[](https://www.ruby-lang.org/)
|
6
|
+
[](https://rubyonrails.org/)
|
7
|
+
|
8
|
+
> 🎯 **Comprehensive Rails Application Architecture Visualization Tool**
|
9
|
+
|
10
|
+
Rails Flow Map is a powerful gem that analyzes your Rails application structure and generates beautiful, interactive visualizations to help understand architecture, dependencies, and data flow patterns.
|
11
|
+
|
12
|
+
**[日本語](README_ja.md) | [中文](README_zh.md)**
|
13
|
+
|
14
|
+
---
|
15
|
+
|
16
|
+
## ✨ Features
|
17
|
+
|
18
|
+
### 🎨 Multiple Visualization Formats
|
19
|
+
- **🌊 Mermaid Diagrams** - GitHub-friendly markdown diagrams
|
20
|
+
- **🏗️ PlantUML** - Detailed UML class diagrams
|
21
|
+
- **🔗 GraphViz** - Network-style relationship graphs
|
22
|
+
- **⚡ Interactive D3.js** - Zoomable, draggable web visualizations
|
23
|
+
- **📊 Metrics Reports** - Code quality and complexity analysis
|
24
|
+
- **🔄 Sequence Diagrams** - API endpoint flow visualization
|
25
|
+
- **📋 OpenAPI Specs** - Auto-generated API documentation
|
26
|
+
- **📈 ERD Diagrams** - Database schema visualization
|
27
|
+
- **🔍 Git Diff Views** - Architecture change comparisons
|
28
|
+
|
29
|
+
### 🛡️ Enterprise-Grade Security
|
30
|
+
- **Path Traversal Protection** - Prevents malicious file access
|
31
|
+
- **XSS Prevention** - Sanitizes all HTML outputs
|
32
|
+
- **Input Validation** - Comprehensive parameter checking
|
33
|
+
- **Security Event Logging** - Tracks potential threats
|
34
|
+
|
35
|
+
### ⚡ Performance & Reliability
|
36
|
+
- **Structured Logging** - Performance metrics and debugging info
|
37
|
+
- **Error Handling** - Robust exception management with context
|
38
|
+
- **Retry Logic** - Automatic recovery from transient failures
|
39
|
+
- **Memory Optimization** - Efficient processing for large applications
|
40
|
+
|
41
|
+
### 🔧 Developer Experience
|
42
|
+
- **Zero Configuration** - Works out of the box
|
43
|
+
- **Flexible Integration** - Rake tasks, Ruby API, CI/CD support
|
44
|
+
- **Comprehensive Documentation** - Examples and best practices
|
45
|
+
- **VS Code Integration** - Built-in task definitions
|
46
|
+
|
47
|
+
---
|
48
|
+
|
49
|
+
## 🚀 Quick Start
|
50
|
+
|
51
|
+
### Installation
|
52
|
+
|
53
|
+
Add to your Gemfile:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
gem 'rails-flow-map'
|
57
|
+
```
|
58
|
+
|
59
|
+
```bash
|
60
|
+
bundle install
|
61
|
+
rails generate rails_flow_map:install
|
62
|
+
```
|
63
|
+
|
64
|
+
### Basic Usage
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
# Generate architecture overview
|
68
|
+
graph = RailsFlowMap.analyze
|
69
|
+
RailsFlowMap.export(graph, format: :mermaid, output: 'docs/architecture.md')
|
70
|
+
|
71
|
+
# Create interactive visualization
|
72
|
+
RailsFlowMap.export(graph, format: :d3js, output: 'public/architecture.html')
|
73
|
+
|
74
|
+
# Generate API documentation
|
75
|
+
RailsFlowMap.export(graph, format: :openapi, output: 'docs/api.yaml')
|
76
|
+
```
|
77
|
+
|
78
|
+
### Using Rake Tasks
|
79
|
+
|
80
|
+
```bash
|
81
|
+
# Generate all visualizations
|
82
|
+
rake flow_map:generate
|
83
|
+
|
84
|
+
# Specific format
|
85
|
+
rake flow_map:generate FORMAT=mermaid OUTPUT=docs/flow.md
|
86
|
+
|
87
|
+
# Analyze API endpoint
|
88
|
+
rake flow_map:endpoint ENDPOINT=/api/v1/users FORMAT=sequence
|
89
|
+
```
|
90
|
+
|
91
|
+
---
|
92
|
+
|
93
|
+
## 📊 Visualization Examples
|
94
|
+
|
95
|
+
### 🌊 Mermaid Architecture Diagram
|
96
|
+
|
97
|
+
```mermaid
|
98
|
+
graph TD
|
99
|
+
User[User] --> Post[Post]
|
100
|
+
User --> Comment[Comment]
|
101
|
+
Post --> Comment
|
102
|
+
UsersController --> User
|
103
|
+
PostsController --> Post
|
104
|
+
API[/api/v1/users] --> UsersController
|
105
|
+
```
|
106
|
+
|
107
|
+
### ⚡ Interactive D3.js Visualization
|
108
|
+
|
109
|
+
*Features: Zoom, drag, filter by component type, search functionality*
|
110
|
+
|
111
|
+
### 📋 OpenAPI Documentation
|
112
|
+
|
113
|
+
```yaml
|
114
|
+
openapi: 3.0.0
|
115
|
+
info:
|
116
|
+
title: Rails API Documentation
|
117
|
+
version: 1.0.0
|
118
|
+
paths:
|
119
|
+
/api/v1/users:
|
120
|
+
get:
|
121
|
+
summary: List all users
|
122
|
+
responses:
|
123
|
+
200:
|
124
|
+
description: Successful response
|
125
|
+
```
|
126
|
+
|
127
|
+
---
|
128
|
+
|
129
|
+
## 🎯 Use Cases
|
130
|
+
|
131
|
+
### 👥 For Development Teams
|
132
|
+
|
133
|
+
- **📚 Documentation** - Auto-generate always up-to-date architecture docs
|
134
|
+
- **🔍 Code Reviews** - Visualize architectural changes in PRs
|
135
|
+
- **🎓 Onboarding** - Help new team members understand the codebase
|
136
|
+
- **🏗️ Refactoring** - Identify dependencies before making changes
|
137
|
+
|
138
|
+
### 🚀 For DevOps & CI/CD
|
139
|
+
|
140
|
+
- **📊 Monitoring** - Track architecture complexity over time
|
141
|
+
- **🔄 Automation** - Generate docs automatically on deployment
|
142
|
+
- **📈 Metrics** - Collect code quality and dependency metrics
|
143
|
+
- **🚨 Alerts** - Detect breaking architectural changes
|
144
|
+
|
145
|
+
### 📋 For API Teams
|
146
|
+
|
147
|
+
- **📖 API Docs** - Auto-generate OpenAPI specifications
|
148
|
+
- **🔄 Flow Diagrams** - Visualize request/response flows
|
149
|
+
- **🧪 Testing** - Understand endpoint dependencies
|
150
|
+
- **📚 Client SDKs** - Provide clear API structure documentation
|
151
|
+
|
152
|
+
---
|
153
|
+
|
154
|
+
## 🔧 Configuration
|
155
|
+
|
156
|
+
### Basic Configuration
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
# config/initializers/rails_flow_map.rb
|
160
|
+
RailsFlowMap.configure do |config|
|
161
|
+
config.output_directory = 'doc/flow_maps'
|
162
|
+
config.exclude_paths = ['vendor/', 'tmp/']
|
163
|
+
config.default_format = :mermaid
|
164
|
+
end
|
165
|
+
```
|
166
|
+
|
167
|
+
### Advanced Configuration
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
RailsFlowMap.configure do |config|
|
171
|
+
# Analysis options
|
172
|
+
config.include_models = true
|
173
|
+
config.include_controllers = true
|
174
|
+
config.include_routes = true
|
175
|
+
|
176
|
+
# Performance options
|
177
|
+
config.streaming_mode = true
|
178
|
+
config.memory_limit = 512.megabytes
|
179
|
+
|
180
|
+
# Security options
|
181
|
+
config.sanitize_output = true
|
182
|
+
config.allow_system_paths = false
|
183
|
+
end
|
184
|
+
```
|
185
|
+
|
186
|
+
---
|
187
|
+
|
188
|
+
## 📚 Documentation
|
189
|
+
|
190
|
+
### Quick References
|
191
|
+
- 📖 [**Usage Examples**](USAGE_EXAMPLES.md) - Comprehensive usage guide
|
192
|
+
- ⚡ [**Quick Reference**](QUICK_REFERENCE.md) - Common commands and patterns
|
193
|
+
- 🔧 [**API Documentation**](https://rubydoc.info/github/railsflowmap/rails-flow-map) - YARD documentation
|
194
|
+
|
195
|
+
### Integration Guides
|
196
|
+
- 🔄 [**CI/CD Integration**](docs/ci_cd_integration.md) - GitHub Actions, GitLab CI
|
197
|
+
- 💻 [**VS Code Integration**](doc/vscode_integration.md) - Editor setup and tasks
|
198
|
+
- 🐳 [**Docker Integration**](docs/docker_integration.md) - Containerized workflows
|
199
|
+
|
200
|
+
### Examples
|
201
|
+
- 🚀 [**Basic Examples**](examples/basic_usage.rb) - Getting started code samples
|
202
|
+
- 🔬 [**Advanced Patterns**](examples/advanced_patterns.rb) - Complex use cases
|
203
|
+
|
204
|
+
---
|
205
|
+
|
206
|
+
## 🛠️ Supported Formats
|
207
|
+
|
208
|
+
| Format | Description | Best For | Output |
|
209
|
+
|--------|-------------|----------|---------|
|
210
|
+
| `mermaid` | GitHub-friendly diagrams | Documentation, README | `.md` |
|
211
|
+
| `plantuml` | Detailed UML diagrams | Technical documentation | `.puml` |
|
212
|
+
| `d3js` | Interactive visualizations | Exploration, presentations | `.html` |
|
213
|
+
| `openapi` | API specifications | API documentation | `.yaml` |
|
214
|
+
| `sequence` | Request flow diagrams | API analysis | `.md` |
|
215
|
+
| `erd` | Database schemas | Data modeling | `.md` |
|
216
|
+
| `metrics` | Code quality reports | Code reviews, monitoring | `.md` |
|
217
|
+
| `graphviz` | Network diagrams | Complex relationships | `.dot` |
|
218
|
+
|
219
|
+
---
|
220
|
+
|
221
|
+
## 🔗 Integrations
|
222
|
+
|
223
|
+
### GitHub Actions
|
224
|
+
|
225
|
+
```yaml
|
226
|
+
name: Generate Architecture Docs
|
227
|
+
on: [push]
|
228
|
+
jobs:
|
229
|
+
docs:
|
230
|
+
runs-on: ubuntu-latest
|
231
|
+
steps:
|
232
|
+
- uses: actions/checkout@v3
|
233
|
+
- uses: ruby/setup-ruby@v1
|
234
|
+
- run: bundle exec rake flow_map:generate_all
|
235
|
+
```
|
236
|
+
|
237
|
+
### VS Code Tasks
|
238
|
+
|
239
|
+
```json
|
240
|
+
{
|
241
|
+
"label": "Generate Architecture Docs",
|
242
|
+
"type": "shell",
|
243
|
+
"command": "bundle exec rake flow_map:generate_all"
|
244
|
+
}
|
245
|
+
```
|
246
|
+
|
247
|
+
### Pre-commit Hooks
|
248
|
+
|
249
|
+
```bash
|
250
|
+
#!/bin/bash
|
251
|
+
bundle exec rake flow_map:diff > ARCHITECTURE_CHANGES.md
|
252
|
+
git add ARCHITECTURE_CHANGES.md
|
253
|
+
```
|
254
|
+
|
255
|
+
---
|
256
|
+
|
257
|
+
## 🤝 Contributing
|
258
|
+
|
259
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
260
|
+
|
261
|
+
### Development Setup
|
262
|
+
|
263
|
+
```bash
|
264
|
+
git clone https://github.com/railsflowmap/rails-flow-map.git
|
265
|
+
cd rails-flow-map
|
266
|
+
bundle install
|
267
|
+
rake spec
|
268
|
+
```
|
269
|
+
|
270
|
+
### Running Tests
|
271
|
+
|
272
|
+
```bash
|
273
|
+
# Run all tests
|
274
|
+
bundle exec rspec
|
275
|
+
|
276
|
+
# Run specific test
|
277
|
+
bundle exec rspec spec/rails_flow_map/formatters/mermaid_formatter_spec.rb
|
278
|
+
|
279
|
+
# Run with coverage
|
280
|
+
COVERAGE=true bundle exec rspec
|
281
|
+
```
|
282
|
+
|
283
|
+
---
|
284
|
+
|
285
|
+
## 📄 License
|
286
|
+
|
287
|
+
Rails Flow Map is released under the [MIT License](LICENSE).
|
288
|
+
|
289
|
+
---
|
290
|
+
|
291
|
+
## 🙏 Acknowledgments
|
292
|
+
|
293
|
+
- Thanks to all [contributors](https://github.com/railsflowmap/rails-flow-map/contributors)
|
294
|
+
- Inspired by the Rails community's need for better architecture visualization
|
295
|
+
- Built with ❤️ for the Rails ecosystem
|
296
|
+
|
297
|
+
---
|
298
|
+
|
299
|
+
## 🔗 Links
|
300
|
+
|
301
|
+
- 📖 [Documentation](https://docs.railsflowmap.org)
|
302
|
+
- 🐛 [Bug Reports](https://github.com/railsflowmap/rails-flow-map/issues)
|
303
|
+
- 💬 [Discussions](https://github.com/railsflowmap/rails-flow-map/discussions)
|
304
|
+
- 🐦 [Twitter](https://twitter.com/railsflowmap)
|
305
|
+
|
306
|
+
---
|
307
|
+
|
308
|
+
<div align="center">
|
309
|
+
|
310
|
+
**⭐ Star us on GitHub if Rails Flow Map helps your team! ⭐**
|
311
|
+
|
312
|
+
[⬆ Back to top](#rails-flow-map-)
|
313
|
+
|
314
|
+
</div>
|
data/README_ja.md
ADDED
@@ -0,0 +1,314 @@
|
|
1
|
+
# Rails Flow Map 🚀
|
2
|
+
|
3
|
+
[](https://github.com/railsflowmap/rails-flow-map)
|
4
|
+
[](LICENSE)
|
5
|
+
[](https://www.ruby-lang.org/)
|
6
|
+
[](https://rubyonrails.org/)
|
7
|
+
|
8
|
+
> 🎯 **包括的なRailsアプリケーションアーキテクチャ可視化ツール**
|
9
|
+
|
10
|
+
Rails Flow MapはRailsアプリケーションの構造を解析し、アーキテクチャ、依存関係、データフローパターンの理解を助ける美しいインタラクティブな可視化を生成する強力なgemです。
|
11
|
+
|
12
|
+
**[English](README.md) | [中文](README_zh.md)**
|
13
|
+
|
14
|
+
---
|
15
|
+
|
16
|
+
## ✨ 機能
|
17
|
+
|
18
|
+
### 🎨 複数の可視化フォーマット
|
19
|
+
- **🌊 Mermaid図** - GitHub対応のMarkdown図
|
20
|
+
- **🏗️ PlantUML** - 詳細なUMLクラス図
|
21
|
+
- **🔗 GraphViz** - ネットワーク型関係図
|
22
|
+
- **⚡ インタラクティブD3.js** - ズーム・ドラッグ可能なWeb可視化
|
23
|
+
- **📊 メトリクスレポート** - コード品質・複雑性解析
|
24
|
+
- **🔄 シーケンス図** - APIエンドポイントフロー可視化
|
25
|
+
- **📋 OpenAPI仕様** - 自動生成API文書
|
26
|
+
- **📈 ERD図** - データベーススキーマ可視化
|
27
|
+
- **🔍 Git差分表示** - アーキテクチャ変更比較
|
28
|
+
|
29
|
+
### 🛡️ エンタープライズレベルのセキュリティ
|
30
|
+
- **パストラバーサル保護** - 悪意のあるファイルアクセスを防止
|
31
|
+
- **XSS防止** - 全HTMLアウトプットのサニタイズ
|
32
|
+
- **入力検証** - 包括的なパラメータチェック
|
33
|
+
- **セキュリティイベントログ** - 潜在的脅威のトラッキング
|
34
|
+
|
35
|
+
### ⚡ パフォーマンス・信頼性
|
36
|
+
- **構造化ログ** - パフォーマンスメトリクスとデバッグ情報
|
37
|
+
- **エラーハンドリング** - コンテキスト付き堅牢な例外管理
|
38
|
+
- **リトライロジック** - 一時的な障害からの自動復旧
|
39
|
+
- **メモリ最適化** - 大規模アプリケーション向け効率的処理
|
40
|
+
|
41
|
+
### 🔧 開発者体験
|
42
|
+
- **ゼロ設定** - すぐに使える
|
43
|
+
- **柔軟な統合** - Rakeタスク、Ruby API、CI/CDサポート
|
44
|
+
- **包括的ドキュメント** - 例とベストプラクティス
|
45
|
+
- **VS Code統合** - 組み込みタスク定義
|
46
|
+
|
47
|
+
---
|
48
|
+
|
49
|
+
## 🚀 クイックスタート
|
50
|
+
|
51
|
+
### インストール
|
52
|
+
|
53
|
+
Gemfileに追加:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
gem 'rails-flow-map'
|
57
|
+
```
|
58
|
+
|
59
|
+
```bash
|
60
|
+
bundle install
|
61
|
+
rails generate rails_flow_map:install
|
62
|
+
```
|
63
|
+
|
64
|
+
### 基本的な使用方法
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
# アーキテクチャ概要を生成
|
68
|
+
graph = RailsFlowMap.analyze
|
69
|
+
RailsFlowMap.export(graph, format: :mermaid, output: 'docs/architecture.md')
|
70
|
+
|
71
|
+
# インタラクティブ可視化を作成
|
72
|
+
RailsFlowMap.export(graph, format: :d3js, output: 'public/architecture.html')
|
73
|
+
|
74
|
+
# API文書を生成
|
75
|
+
RailsFlowMap.export(graph, format: :openapi, output: 'docs/api.yaml')
|
76
|
+
```
|
77
|
+
|
78
|
+
### Rakeタスクの使用
|
79
|
+
|
80
|
+
```bash
|
81
|
+
# 全ての可視化を生成
|
82
|
+
rake flow_map:generate
|
83
|
+
|
84
|
+
# 特定のフォーマット
|
85
|
+
rake flow_map:generate FORMAT=mermaid OUTPUT=docs/flow.md
|
86
|
+
|
87
|
+
# APIエンドポイント解析
|
88
|
+
rake flow_map:endpoint ENDPOINT=/api/v1/users FORMAT=sequence
|
89
|
+
```
|
90
|
+
|
91
|
+
---
|
92
|
+
|
93
|
+
## 📊 可視化例
|
94
|
+
|
95
|
+
### 🌊 Mermaidアーキテクチャ図
|
96
|
+
|
97
|
+
```mermaid
|
98
|
+
graph TD
|
99
|
+
User[User] --> Post[Post]
|
100
|
+
User --> Comment[Comment]
|
101
|
+
Post --> Comment
|
102
|
+
UsersController --> User
|
103
|
+
PostsController --> Post
|
104
|
+
API[/api/v1/users] --> UsersController
|
105
|
+
```
|
106
|
+
|
107
|
+
### ⚡ インタラクティブD3.js可視化
|
108
|
+
|
109
|
+
*機能: ズーム、ドラッグ、コンポーネントタイプ別フィルタ、検索機能*
|
110
|
+
|
111
|
+
### 📋 OpenAPI文書
|
112
|
+
|
113
|
+
```yaml
|
114
|
+
openapi: 3.0.0
|
115
|
+
info:
|
116
|
+
title: Rails API Documentation
|
117
|
+
version: 1.0.0
|
118
|
+
paths:
|
119
|
+
/api/v1/users:
|
120
|
+
get:
|
121
|
+
summary: 全ユーザーを取得
|
122
|
+
responses:
|
123
|
+
200:
|
124
|
+
description: 成功レスポンス
|
125
|
+
```
|
126
|
+
|
127
|
+
---
|
128
|
+
|
129
|
+
## 🎯 使用例
|
130
|
+
|
131
|
+
### 👥 開発チーム向け
|
132
|
+
|
133
|
+
- **📚 文書化** - 常に最新のアーキテクチャ文書を自動生成
|
134
|
+
- **🔍 コードレビュー** - PRでアーキテクチャ変更を可視化
|
135
|
+
- **🎓 オンボーディング** - 新メンバーがコードベースを理解する支援
|
136
|
+
- **🏗️ リファクタリング** - 変更前に依存関係を特定
|
137
|
+
|
138
|
+
### 🚀 DevOps・CI/CD向け
|
139
|
+
|
140
|
+
- **📊 モニタリング** - アーキテクチャ複雑性の経時変化を追跡
|
141
|
+
- **🔄 自動化** - デプロイ時に文書を自動生成
|
142
|
+
- **📈 メトリクス** - コード品質と依存関係メトリクスを収集
|
143
|
+
- **🚨 アラート** - 破壊的なアーキテクチャ変更を検出
|
144
|
+
|
145
|
+
### 📋 APIチーム向け
|
146
|
+
|
147
|
+
- **📖 API文書** - OpenAPI仕様書を自動生成
|
148
|
+
- **🔄 フロー図** - リクエスト/レスポンスフローを可視化
|
149
|
+
- **🧪 テスト** - エンドポイント依存関係を理解
|
150
|
+
- **📚 クライアントSDK** - 明確なAPI構造文書を提供
|
151
|
+
|
152
|
+
---
|
153
|
+
|
154
|
+
## 🔧 設定
|
155
|
+
|
156
|
+
### 基本設定
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
# config/initializers/rails_flow_map.rb
|
160
|
+
RailsFlowMap.configure do |config|
|
161
|
+
config.output_directory = 'doc/flow_maps'
|
162
|
+
config.exclude_paths = ['vendor/', 'tmp/']
|
163
|
+
config.default_format = :mermaid
|
164
|
+
end
|
165
|
+
```
|
166
|
+
|
167
|
+
### 高度な設定
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
RailsFlowMap.configure do |config|
|
171
|
+
# 解析オプション
|
172
|
+
config.include_models = true
|
173
|
+
config.include_controllers = true
|
174
|
+
config.include_routes = true
|
175
|
+
|
176
|
+
# パフォーマンスオプション
|
177
|
+
config.streaming_mode = true
|
178
|
+
config.memory_limit = 512.megabytes
|
179
|
+
|
180
|
+
# セキュリティオプション
|
181
|
+
config.sanitize_output = true
|
182
|
+
config.allow_system_paths = false
|
183
|
+
end
|
184
|
+
```
|
185
|
+
|
186
|
+
---
|
187
|
+
|
188
|
+
## 📚 ドキュメント
|
189
|
+
|
190
|
+
### クイックリファレンス
|
191
|
+
- 📖 [**使用例**](USAGE_EXAMPLES.md) - 包括的な使用ガイド
|
192
|
+
- ⚡ [**クイックリファレンス**](QUICK_REFERENCE.md) - 一般的なコマンドとパターン
|
193
|
+
- 🔧 [**APIドキュメント**](https://rubydoc.info/github/railsflowmap/rails-flow-map) - YARD文書
|
194
|
+
|
195
|
+
### 統合ガイド
|
196
|
+
- 🔄 [**CI/CD統合**](docs/ci_cd_integration.md) - GitHub Actions、GitLab CI
|
197
|
+
- 💻 [**VS Code統合**](doc/vscode_integration.md) - エディタ設定とタスク
|
198
|
+
- 🐳 [**Docker統合**](docs/docker_integration.md) - コンテナ化ワークフロー
|
199
|
+
|
200
|
+
### 例
|
201
|
+
- 🚀 [**基本例**](examples/basic_usage.rb) - 入門コードサンプル
|
202
|
+
- 🔬 [**高度なパターン**](examples/advanced_patterns.rb) - 複雑な使用例
|
203
|
+
|
204
|
+
---
|
205
|
+
|
206
|
+
## 🛠️ サポートされるフォーマット
|
207
|
+
|
208
|
+
| フォーマット | 説明 | 適用場面 | 出力 |
|
209
|
+
|--------|-------------|----------|---------|
|
210
|
+
| `mermaid` | GitHub対応図 | 文書、README | `.md` |
|
211
|
+
| `plantuml` | 詳細UML図 | 技術文書 | `.puml` |
|
212
|
+
| `d3js` | インタラクティブ可視化 | 探索、プレゼン | `.html` |
|
213
|
+
| `openapi` | API仕様書 | API文書 | `.yaml` |
|
214
|
+
| `sequence` | リクエストフロー図 | API解析 | `.md` |
|
215
|
+
| `erd` | データベーススキーマ | データモデリング | `.md` |
|
216
|
+
| `metrics` | コード品質レポート | コードレビュー、監視 | `.md` |
|
217
|
+
| `graphviz` | ネットワーク図 | 複雑な関係 | `.dot` |
|
218
|
+
|
219
|
+
---
|
220
|
+
|
221
|
+
## 🔗 統合
|
222
|
+
|
223
|
+
### GitHub Actions
|
224
|
+
|
225
|
+
```yaml
|
226
|
+
name: アーキテクチャ文書生成
|
227
|
+
on: [push]
|
228
|
+
jobs:
|
229
|
+
docs:
|
230
|
+
runs-on: ubuntu-latest
|
231
|
+
steps:
|
232
|
+
- uses: actions/checkout@v3
|
233
|
+
- uses: ruby/setup-ruby@v1
|
234
|
+
- run: bundle exec rake flow_map:generate_all
|
235
|
+
```
|
236
|
+
|
237
|
+
### VS Codeタスク
|
238
|
+
|
239
|
+
```json
|
240
|
+
{
|
241
|
+
"label": "アーキテクチャ文書生成",
|
242
|
+
"type": "shell",
|
243
|
+
"command": "bundle exec rake flow_map:generate_all"
|
244
|
+
}
|
245
|
+
```
|
246
|
+
|
247
|
+
### Pre-commitフック
|
248
|
+
|
249
|
+
```bash
|
250
|
+
#!/bin/bash
|
251
|
+
bundle exec rake flow_map:diff > ARCHITECTURE_CHANGES.md
|
252
|
+
git add ARCHITECTURE_CHANGES.md
|
253
|
+
```
|
254
|
+
|
255
|
+
---
|
256
|
+
|
257
|
+
## 🤝 貢献
|
258
|
+
|
259
|
+
貢献を歓迎します!詳細は[貢献ガイド](CONTRIBUTING.md)をご覧ください。
|
260
|
+
|
261
|
+
### 開発環境設定
|
262
|
+
|
263
|
+
```bash
|
264
|
+
git clone https://github.com/railsflowmap/rails-flow-map.git
|
265
|
+
cd rails-flow-map
|
266
|
+
bundle install
|
267
|
+
rake spec
|
268
|
+
```
|
269
|
+
|
270
|
+
### テスト実行
|
271
|
+
|
272
|
+
```bash
|
273
|
+
# 全テスト実行
|
274
|
+
bundle exec rspec
|
275
|
+
|
276
|
+
# 特定テスト実行
|
277
|
+
bundle exec rspec spec/rails_flow_map/formatters/mermaid_formatter_spec.rb
|
278
|
+
|
279
|
+
# カバレッジ付き実行
|
280
|
+
COVERAGE=true bundle exec rspec
|
281
|
+
```
|
282
|
+
|
283
|
+
---
|
284
|
+
|
285
|
+
## 📄 ライセンス
|
286
|
+
|
287
|
+
Rails Flow Mapは[MITライセンス](LICENSE)でリリースされています。
|
288
|
+
|
289
|
+
---
|
290
|
+
|
291
|
+
## 🙏 謝辞
|
292
|
+
|
293
|
+
- 全ての[貢献者](https://github.com/railsflowmap/rails-flow-map/contributors)に感謝
|
294
|
+
- より良いアーキテクチャ可視化を求めるRailsコミュニティにインスパイア
|
295
|
+
- Railsエコシステムへの❤️で構築
|
296
|
+
|
297
|
+
---
|
298
|
+
|
299
|
+
## 🔗 リンク
|
300
|
+
|
301
|
+
- 📖 [ドキュメント](https://docs.railsflowmap.org)
|
302
|
+
- 🐛 [バグレポート](https://github.com/railsflowmap/rails-flow-map/issues)
|
303
|
+
- 💬 [ディスカッション](https://github.com/railsflowmap/rails-flow-map/discussions)
|
304
|
+
- 🐦 [Twitter](https://twitter.com/railsflowmap)
|
305
|
+
|
306
|
+
---
|
307
|
+
|
308
|
+
<div align="center">
|
309
|
+
|
310
|
+
**⭐ Rails Flow Mapがチームの役に立ったらGitHubでスターを! ⭐**
|
311
|
+
|
312
|
+
[⬆ トップに戻る](#rails-flow-map-)
|
313
|
+
|
314
|
+
</div>
|