simple_flow 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/.envrc +1 -0
- data/.github/workflows/deploy-github-pages.yml +52 -0
- data/.rubocop.yml +57 -0
- data/CHANGELOG.md +4 -0
- data/COMMITS.md +196 -0
- data/LICENSE +21 -0
- data/README.md +481 -0
- data/Rakefile +15 -0
- data/benchmarks/parallel_vs_sequential.rb +98 -0
- data/benchmarks/pipeline_overhead.rb +130 -0
- data/docs/api/middleware.md +468 -0
- data/docs/api/parallel-step.md +363 -0
- data/docs/api/pipeline.md +382 -0
- data/docs/api/result.md +375 -0
- data/docs/concurrent/best-practices.md +687 -0
- data/docs/concurrent/introduction.md +246 -0
- data/docs/concurrent/parallel-steps.md +418 -0
- data/docs/concurrent/performance.md +481 -0
- data/docs/core-concepts/flow-control.md +452 -0
- data/docs/core-concepts/middleware.md +389 -0
- data/docs/core-concepts/overview.md +219 -0
- data/docs/core-concepts/pipeline.md +315 -0
- data/docs/core-concepts/result.md +168 -0
- data/docs/core-concepts/steps.md +391 -0
- data/docs/development/benchmarking.md +443 -0
- data/docs/development/contributing.md +380 -0
- data/docs/development/dagwood-concepts.md +435 -0
- data/docs/development/testing.md +514 -0
- data/docs/getting-started/examples.md +197 -0
- data/docs/getting-started/installation.md +62 -0
- data/docs/getting-started/quick-start.md +218 -0
- data/docs/guides/choosing-concurrency-model.md +441 -0
- data/docs/guides/complex-workflows.md +440 -0
- data/docs/guides/data-fetching.md +478 -0
- data/docs/guides/error-handling.md +635 -0
- data/docs/guides/file-processing.md +505 -0
- data/docs/guides/validation-patterns.md +496 -0
- data/docs/index.md +169 -0
- data/examples/.gitignore +3 -0
- data/examples/01_basic_pipeline.rb +112 -0
- data/examples/02_error_handling.rb +178 -0
- data/examples/03_middleware.rb +186 -0
- data/examples/04_parallel_automatic.rb +221 -0
- data/examples/05_parallel_explicit.rb +279 -0
- data/examples/06_real_world_ecommerce.rb +288 -0
- data/examples/07_real_world_etl.rb +277 -0
- data/examples/08_graph_visualization.rb +246 -0
- data/examples/09_pipeline_visualization.rb +266 -0
- data/examples/10_concurrency_control.rb +235 -0
- data/examples/11_sequential_dependencies.rb +243 -0
- data/examples/12_none_constant.rb +161 -0
- data/examples/README.md +374 -0
- data/examples/regression_test/01_basic_pipeline.txt +38 -0
- data/examples/regression_test/02_error_handling.txt +92 -0
- data/examples/regression_test/03_middleware.txt +61 -0
- data/examples/regression_test/04_parallel_automatic.txt +86 -0
- data/examples/regression_test/05_parallel_explicit.txt +80 -0
- data/examples/regression_test/06_real_world_ecommerce.txt +53 -0
- data/examples/regression_test/07_real_world_etl.txt +58 -0
- data/examples/regression_test/08_graph_visualization.txt +429 -0
- data/examples/regression_test/09_pipeline_visualization.txt +305 -0
- data/examples/regression_test/10_concurrency_control.txt +96 -0
- data/examples/regression_test/11_sequential_dependencies.txt +86 -0
- data/examples/regression_test/12_none_constant.txt +64 -0
- data/examples/regression_test.rb +105 -0
- data/lib/simple_flow/dependency_graph.rb +120 -0
- data/lib/simple_flow/dependency_graph_visualizer.rb +326 -0
- data/lib/simple_flow/middleware.rb +36 -0
- data/lib/simple_flow/parallel_executor.rb +80 -0
- data/lib/simple_flow/pipeline.rb +405 -0
- data/lib/simple_flow/result.rb +88 -0
- data/lib/simple_flow/step_tracker.rb +58 -0
- data/lib/simple_flow/version.rb +5 -0
- data/lib/simple_flow.rb +41 -0
- data/mkdocs.yml +146 -0
- data/pipeline_graph.dot +51 -0
- data/pipeline_graph.html +60 -0
- data/pipeline_graph.mmd +19 -0
- metadata +127 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
# Contributing to SimpleFlow
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to SimpleFlow! This guide will help you get started.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
### Fork and Clone
|
|
8
|
+
|
|
9
|
+
1. Fork the repository on GitHub
|
|
10
|
+
2. Clone your fork locally:
|
|
11
|
+
```bash
|
|
12
|
+
git clone https://github.com/YOUR_USERNAME/simple_flow.git
|
|
13
|
+
cd simple_flow
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
3. Add the upstream repository:
|
|
17
|
+
```bash
|
|
18
|
+
git remote add upstream https://github.com/madbomber/simple_flow.git
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Install Dependencies
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
bundle install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Run Tests
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
bundle exec rake test
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Expected output:
|
|
34
|
+
```
|
|
35
|
+
77 tests, 296 assertions, 0 failures, 0 errors, 0 skips
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Development Workflow
|
|
39
|
+
|
|
40
|
+
### 1. Create a Branch
|
|
41
|
+
|
|
42
|
+
Create a feature branch from `main`:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
git checkout -b feature/your-feature-name
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Branch naming conventions:
|
|
49
|
+
- `feature/` - New features
|
|
50
|
+
- `fix/` - Bug fixes
|
|
51
|
+
- `docs/` - Documentation changes
|
|
52
|
+
- `refactor/` - Code refactoring
|
|
53
|
+
- `test/` - Test additions or improvements
|
|
54
|
+
|
|
55
|
+
### 2. Make Your Changes
|
|
56
|
+
|
|
57
|
+
#### Code Style
|
|
58
|
+
|
|
59
|
+
SimpleFlow follows standard Ruby conventions. Please ensure:
|
|
60
|
+
|
|
61
|
+
- Use 2 spaces for indentation
|
|
62
|
+
- Keep lines under 120 characters when possible
|
|
63
|
+
- Add comments for complex logic
|
|
64
|
+
- Use descriptive variable names
|
|
65
|
+
|
|
66
|
+
#### Adding Features
|
|
67
|
+
|
|
68
|
+
When adding a new feature:
|
|
69
|
+
|
|
70
|
+
1. **Write tests first** (TDD approach)
|
|
71
|
+
2. Implement the feature
|
|
72
|
+
3. Update documentation
|
|
73
|
+
4. Add examples if applicable
|
|
74
|
+
|
|
75
|
+
#### Fixing Bugs
|
|
76
|
+
|
|
77
|
+
When fixing a bug:
|
|
78
|
+
|
|
79
|
+
1. Add a failing test that reproduces the bug
|
|
80
|
+
2. Fix the bug
|
|
81
|
+
3. Ensure the test passes
|
|
82
|
+
4. Consider adding regression tests
|
|
83
|
+
|
|
84
|
+
### 3. Run Tests
|
|
85
|
+
|
|
86
|
+
Run the full test suite:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
bundle exec rake test
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Run a specific test file:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
ruby -Ilib:test test/pipeline_test.rb
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Run a specific test:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
ruby -Ilib:test test/pipeline_test.rb -n test_basic_pipeline
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 4. Update Documentation
|
|
105
|
+
|
|
106
|
+
If your changes affect user-facing behavior:
|
|
107
|
+
|
|
108
|
+
1. Update relevant documentation in `docs/`
|
|
109
|
+
2. Update the README if needed
|
|
110
|
+
3. Add or update code examples
|
|
111
|
+
4. Update CHANGELOG.md
|
|
112
|
+
|
|
113
|
+
### 5. Commit Your Changes
|
|
114
|
+
|
|
115
|
+
Write clear, descriptive commit messages:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
git add .
|
|
119
|
+
git commit -m "Add feature: parallel execution for named steps
|
|
120
|
+
|
|
121
|
+
- Implement dependency graph analysis
|
|
122
|
+
- Add automatic parallel detection
|
|
123
|
+
- Include tests and documentation
|
|
124
|
+
"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Commit message guidelines:
|
|
128
|
+
- Use present tense ("Add feature" not "Added feature")
|
|
129
|
+
- First line should be under 72 characters
|
|
130
|
+
- Include a blank line after the first line
|
|
131
|
+
- Provide detailed description in the body if needed
|
|
132
|
+
|
|
133
|
+
### 6. Push and Create Pull Request
|
|
134
|
+
|
|
135
|
+
Push your branch:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
git push origin feature/your-feature-name
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Create a pull request on GitHub:
|
|
142
|
+
1. Go to the SimpleFlow repository
|
|
143
|
+
2. Click "New Pull Request"
|
|
144
|
+
3. Select your branch
|
|
145
|
+
4. Fill out the pull request template
|
|
146
|
+
5. Submit for review
|
|
147
|
+
|
|
148
|
+
## Pull Request Guidelines
|
|
149
|
+
|
|
150
|
+
### PR Template
|
|
151
|
+
|
|
152
|
+
```markdown
|
|
153
|
+
## Description
|
|
154
|
+
|
|
155
|
+
Brief description of what this PR does.
|
|
156
|
+
|
|
157
|
+
## Type of Change
|
|
158
|
+
|
|
159
|
+
- [ ] Bug fix
|
|
160
|
+
- [ ] New feature
|
|
161
|
+
- [ ] Breaking change
|
|
162
|
+
- [ ] Documentation update
|
|
163
|
+
|
|
164
|
+
## Changes Made
|
|
165
|
+
|
|
166
|
+
- List of specific changes
|
|
167
|
+
- Another change
|
|
168
|
+
- And another
|
|
169
|
+
|
|
170
|
+
## Testing
|
|
171
|
+
|
|
172
|
+
Describe how you tested your changes:
|
|
173
|
+
|
|
174
|
+
- [ ] All existing tests pass
|
|
175
|
+
- [ ] Added new tests for new functionality
|
|
176
|
+
- [ ] Tested manually with examples
|
|
177
|
+
|
|
178
|
+
## Documentation
|
|
179
|
+
|
|
180
|
+
- [ ] Updated relevant documentation
|
|
181
|
+
- [ ] Updated CHANGELOG.md
|
|
182
|
+
- [ ] Added/updated code examples
|
|
183
|
+
|
|
184
|
+
## Checklist
|
|
185
|
+
|
|
186
|
+
- [ ] Code follows project style guidelines
|
|
187
|
+
- [ ] Self-review completed
|
|
188
|
+
- [ ] Comments added for complex code
|
|
189
|
+
- [ ] No new warnings generated
|
|
190
|
+
- [ ] Tests added and passing
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Code Review Process
|
|
194
|
+
|
|
195
|
+
1. **Automated Checks**: GitHub Actions will run tests automatically
|
|
196
|
+
2. **Peer Review**: A maintainer will review your code
|
|
197
|
+
3. **Feedback**: Address any requested changes
|
|
198
|
+
4. **Approval**: Once approved, your PR will be merged
|
|
199
|
+
|
|
200
|
+
## Testing Guidelines
|
|
201
|
+
|
|
202
|
+
### Test Structure
|
|
203
|
+
|
|
204
|
+
Tests use Minitest:
|
|
205
|
+
|
|
206
|
+
```ruby
|
|
207
|
+
require 'test_helper'
|
|
208
|
+
|
|
209
|
+
class MyFeatureTest < Minitest::Test
|
|
210
|
+
def setup
|
|
211
|
+
# Setup code runs before each test
|
|
212
|
+
@pipeline = SimpleFlow::Pipeline.new
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def test_feature_works
|
|
216
|
+
result = @pipeline.call(SimpleFlow::Result.new(42))
|
|
217
|
+
|
|
218
|
+
assert result.continue?
|
|
219
|
+
assert_equal 42, result.value
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def test_handles_errors
|
|
223
|
+
result = @pipeline.call(SimpleFlow::Result.new(nil))
|
|
224
|
+
|
|
225
|
+
refute result.continue?
|
|
226
|
+
assert result.errors.any?
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Test Coverage
|
|
232
|
+
|
|
233
|
+
Aim for comprehensive test coverage:
|
|
234
|
+
|
|
235
|
+
- Test happy paths
|
|
236
|
+
- Test error conditions
|
|
237
|
+
- Test edge cases
|
|
238
|
+
- Test with various data types
|
|
239
|
+
|
|
240
|
+
Current test coverage: **96.61%** (121 tests, 296 assertions)
|
|
241
|
+
|
|
242
|
+
### Running Specific Tests
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Run all tests
|
|
246
|
+
bundle exec rake test
|
|
247
|
+
|
|
248
|
+
# Run specific test file
|
|
249
|
+
ruby -Ilib:test test/result_test.rb
|
|
250
|
+
|
|
251
|
+
# Run specific test method
|
|
252
|
+
ruby -Ilib:test test/result_test.rb -n test_with_context
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Documentation Guidelines
|
|
256
|
+
|
|
257
|
+
### Adding Documentation
|
|
258
|
+
|
|
259
|
+
When adding new features, update:
|
|
260
|
+
|
|
261
|
+
1. **API Reference** (`docs/api/`)
|
|
262
|
+
- Complete method signatures
|
|
263
|
+
- Parameters and return values
|
|
264
|
+
- Examples
|
|
265
|
+
|
|
266
|
+
2. **Guides** (`docs/guides/`)
|
|
267
|
+
- How-to guides
|
|
268
|
+
- Best practices
|
|
269
|
+
- Real-world examples
|
|
270
|
+
|
|
271
|
+
3. **README.md**
|
|
272
|
+
- Overview of feature
|
|
273
|
+
- Quick start example
|
|
274
|
+
|
|
275
|
+
### Documentation Style
|
|
276
|
+
|
|
277
|
+
- Use clear, concise language
|
|
278
|
+
- Include code examples
|
|
279
|
+
- Cross-reference related documentation
|
|
280
|
+
- Keep examples practical and realistic
|
|
281
|
+
|
|
282
|
+
## Project Structure
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
simple_flow/
|
|
286
|
+
├── lib/
|
|
287
|
+
│ └── simple_flow/
|
|
288
|
+
│ ├── dependency_graph.rb # Dependency graph analysis
|
|
289
|
+
│ ├── dependency_graph_visualizer.rb # Visualization tools
|
|
290
|
+
│ ├── middleware.rb # Built-in middleware
|
|
291
|
+
│ ├── parallel_executor.rb # Parallel execution
|
|
292
|
+
│ ├── pipeline.rb # Pipeline orchestration
|
|
293
|
+
│ ├── result.rb # Result value object
|
|
294
|
+
│ ├── step_tracker.rb # Step tracking
|
|
295
|
+
│ └── version.rb # Version number
|
|
296
|
+
├── test/
|
|
297
|
+
│ ├── test_helper.rb # Test configuration
|
|
298
|
+
│ ├── result_test.rb # Result tests
|
|
299
|
+
│ ├── pipeline_test.rb # Pipeline tests
|
|
300
|
+
│ ├── middleware_test.rb # Middleware tests
|
|
301
|
+
│ ├── parallel_execution_test.rb # Parallel execution tests
|
|
302
|
+
│ └── dependency_graph_test.rb # Graph analysis tests
|
|
303
|
+
├── examples/
|
|
304
|
+
│ ├── 01_basic_pipeline.rb # Basic usage
|
|
305
|
+
│ ├── 02_error_handling.rb # Error patterns
|
|
306
|
+
│ ├── 03_middleware.rb # Middleware examples
|
|
307
|
+
│ ├── 04_parallel_automatic.rb # Auto parallel
|
|
308
|
+
│ ├── 05_parallel_explicit.rb # Explicit parallel
|
|
309
|
+
│ ├── 06_real_world_ecommerce.rb # E-commerce example
|
|
310
|
+
│ ├── 07_real_world_etl.rb # ETL example
|
|
311
|
+
│ ├── 08_graph_visualization.rb # Graph viz
|
|
312
|
+
│ └── 09_pipeline_visualization.rb # Pipeline viz
|
|
313
|
+
├── docs/ # Documentation
|
|
314
|
+
└── CHANGELOG.md # Change history
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Adding Examples
|
|
318
|
+
|
|
319
|
+
When adding examples:
|
|
320
|
+
|
|
321
|
+
1. Place in `examples/` directory
|
|
322
|
+
2. Use clear, descriptive names
|
|
323
|
+
3. Include comments explaining the code
|
|
324
|
+
4. Make examples runnable
|
|
325
|
+
5. Demonstrate real-world use cases
|
|
326
|
+
|
|
327
|
+
Example template:
|
|
328
|
+
|
|
329
|
+
```ruby
|
|
330
|
+
#!/usr/bin/env ruby
|
|
331
|
+
# frozen_string_literal: true
|
|
332
|
+
|
|
333
|
+
require_relative '../lib/simple_flow'
|
|
334
|
+
|
|
335
|
+
# Description of what this example demonstrates
|
|
336
|
+
|
|
337
|
+
puts "=" * 60
|
|
338
|
+
puts "Example: Your Example Name"
|
|
339
|
+
puts "=" * 60
|
|
340
|
+
puts
|
|
341
|
+
|
|
342
|
+
# Your example code here
|
|
343
|
+
|
|
344
|
+
puts "\n" + "=" * 60
|
|
345
|
+
puts "Example completed!"
|
|
346
|
+
puts "=" * 60
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Releasing
|
|
350
|
+
|
|
351
|
+
(For maintainers only)
|
|
352
|
+
|
|
353
|
+
1. Update version in `lib/simple_flow/version.rb`
|
|
354
|
+
2. Update CHANGELOG.md
|
|
355
|
+
3. Commit changes
|
|
356
|
+
4. Create git tag: `git tag v0.x.x`
|
|
357
|
+
5. Push tag: `git push --tags`
|
|
358
|
+
6. Build gem: `gem build simple_flow.gemspec`
|
|
359
|
+
7. Push to RubyGems: `gem push simple_flow-0.x.x.gem`
|
|
360
|
+
|
|
361
|
+
## Getting Help
|
|
362
|
+
|
|
363
|
+
- **Issues**: Open an issue on GitHub
|
|
364
|
+
- **Discussions**: Use GitHub Discussions for questions
|
|
365
|
+
- **Email**: Contact maintainers directly for sensitive issues
|
|
366
|
+
|
|
367
|
+
## Code of Conduct
|
|
368
|
+
|
|
369
|
+
- Be respectful and inclusive
|
|
370
|
+
- Provide constructive feedback
|
|
371
|
+
- Focus on the code, not the person
|
|
372
|
+
- Help others learn and grow
|
|
373
|
+
|
|
374
|
+
## License
|
|
375
|
+
|
|
376
|
+
By contributing to SimpleFlow, you agree that your contributions will be licensed under the project's license.
|
|
377
|
+
|
|
378
|
+
## Thank You!
|
|
379
|
+
|
|
380
|
+
Your contributions make SimpleFlow better for everyone. Thank you for taking the time to contribute!
|