|
1 | | -# Stroma |
| 1 | +<h1 align="center">Stroma</h1> |
2 | 2 |
|
3 | | -Soon |
| 3 | +<p align="center"> |
| 4 | + A foundation for building modular, extensible DSLs in Ruby. |
| 5 | +</p> |
| 6 | + |
| 7 | +<p align="center"> |
| 8 | + <a href="https://rubygems.org/gems/stroma"><img src="https://img.shields.io/gem/v/stroma?logo=rubygems&logoColor=fff" alt="Gem version"></a> |
| 9 | + <a href="https://github.com/servactory/stroma/releases"><img src="https://img.shields.io/github/release-date/servactory/stroma" alt="Release Date"></a> |
| 10 | + <a href="https://rubygems.org/gems/stroma"><img src="https://img.shields.io/gem/dt/stroma" alt="Downloads"></a> |
| 11 | + <a href="https://www.ruby-lang.org"><img src="https://img.shields.io/badge/Ruby-3.2+-red" alt="Ruby version"></a> |
| 12 | +</p> |
| 13 | + |
| 14 | +<!-- |
| 15 | +## 📚 Documentation |
| 16 | +
|
| 17 | +See [stroma.servactory.com](https://stroma.servactory.com) for documentation, including: |
| 18 | +
|
| 19 | +- Architecture overview |
| 20 | +- Registry and DSL modules |
| 21 | +- Hooks and extensions |
| 22 | +- Settings hierarchy |
| 23 | +- API reference |
| 24 | +--> |
| 25 | + |
| 26 | +## 💡 Why Stroma? |
| 27 | + |
| 28 | +Building modular DSLs shouldn't require reinventing the wheel. Stroma provides a structured approach for library authors to compose DSL modules with: |
| 29 | + |
| 30 | +- 🔌 **Module Registration** - Register DSL modules at boot time, compose them into a unified interface |
| 31 | +- 🧱 **Structured Composition** - Include all registered modules automatically via single DSL entry point |
| 32 | +- 🏛️ **Inheritance Safe** - Per-class state isolation with automatic deep copying |
| 33 | +- 🪝 **Extension Hooks** - Optional before/after hooks for user customization |
| 34 | +- ⚙️ **Extension Settings** - Three-level hierarchical storage for extension configuration |
| 35 | +- 🔒 **Thread Safe** - Immutable registry after finalization, safe concurrent reads |
| 36 | + |
| 37 | +## 🧬 Concept |
| 38 | + |
| 39 | +Stroma is a foundation for library authors building DSL-driven frameworks (service objects, form objects, decorators, etc.). |
| 40 | + |
| 41 | +**Core lifecycle:** |
| 42 | +1. **Register** - Define DSL modules at boot time via `Stroma::Registry` |
| 43 | +2. **Compose** - Classes include `Stroma::DSL` to gain all registered modules automatically |
| 44 | +3. **Extend** (optional) - Users can add cross-cutting logic via `before`/`after` hooks |
| 45 | + |
| 46 | +## 🚀 Quick Start |
| 47 | + |
| 48 | +### Installation |
| 49 | + |
| 50 | +```ruby |
| 51 | +gem "stroma" |
| 52 | +``` |
| 53 | + |
| 54 | +### Define your library's DSL |
| 55 | + |
| 56 | +```ruby |
| 57 | +module MyLib |
| 58 | + module DSL |
| 59 | + # Register DSL modules at load time |
| 60 | + Stroma::Registry.register(:inputs, MyLib::Inputs::DSL) |
| 61 | + Stroma::Registry.register(:actions, MyLib::Actions::DSL) |
| 62 | + Stroma::Registry.finalize! |
| 63 | + |
| 64 | + def self.included(base) |
| 65 | + base.include(Stroma::DSL) |
| 66 | + end |
| 67 | + end |
| 68 | +end |
| 69 | +``` |
| 70 | + |
| 71 | +### Create base class |
| 72 | + |
| 73 | +```ruby |
| 74 | +module MyLib |
| 75 | + class Base |
| 76 | + include MyLib::DSL |
| 77 | + end |
| 78 | +end |
| 79 | +``` |
| 80 | + |
| 81 | +### Usage |
| 82 | + |
| 83 | +```ruby |
| 84 | +class UserService < MyLib::Base |
| 85 | + input :email, type: String |
| 86 | + |
| 87 | + make :create_user |
| 88 | + |
| 89 | + private |
| 90 | + |
| 91 | + def create_user |
| 92 | + # implementation |
| 93 | + end |
| 94 | +end |
| 95 | +``` |
| 96 | + |
| 97 | +## 🤝 Contributing |
| 98 | + |
| 99 | +We welcome contributions! Check out our [Contributing Guide](https://github.com/servactory/stroma/blob/main/CONTRIBUTING.md) to get started. |
| 100 | + |
| 101 | +**Ways to contribute:** |
| 102 | +- 🐛 Report bugs and issues |
| 103 | +- 💡 Suggest new features |
| 104 | +- 📝 Improve documentation |
| 105 | +- 🧪 Add test cases |
| 106 | +- 🔧 Submit pull requests |
| 107 | + |
| 108 | +## 🙏 Acknowledgments |
| 109 | + |
| 110 | +Special thanks to all our [contributors](https://github.com/servactory/stroma/graphs/contributors)! |
| 111 | + |
| 112 | +## 📄 License |
| 113 | + |
| 114 | +Stroma is available as open source under the terms of the [MIT License](./LICENSE). |
0 commit comments