https://github.com/radf0x/domain-generator
A gem that generate boilerplates when creating new domain services
https://github.com/radf0x/domain-generator
boilerplates ddd dry-rb generators rails ruby ruby-gems ruby-on-rails
Last synced: 5 months ago
JSON representation
A gem that generate boilerplates when creating new domain services
- Host: GitHub
- URL: https://github.com/radf0x/domain-generator
- Owner: radf0x
- Created: 2019-07-11T07:39:17.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-12T05:41:20.000Z (about 6 years ago)
- Last Synced: 2024-10-29T14:18:28.531Z (9 months ago)
- Topics: boilerplates, ddd, dry-rb, generators, rails, ruby, ruby-gems, ruby-on-rails
- Language: Ruby
- Homepage:
- Size: 4.88 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rails generator for Domain-driven design application

# Supporting Rails 3.2.0 or above
# How to use
1. Install:
```
$ gem install domain-generator
```
2. Gemfile:
```ruby
gem 'domain-generator', '~> 0.1.0'
```
3. Build the gem yourself:
```
$ gem build domain-generator.gemspec
```
3. Try it out:
```
$ rails generate domain [DOMAIN_NAME] [options]
```
### Options
1. `--include-dry` | `--no-include-dry`
- Generate class and spec with [dry-monads](https://dry-rb.org/gems/dry-monads)
2. `--repo` | `--no-repo`
- Generate repository class for the model
3. `--app-service`
- Generate the application service class
4. `--service`
- Generate the service class
5. `--model`
- Generate the Entity / Model class
### To generate everything

### To generate model without repository

### You can also just generate a particular class and spec

### It won't generate anything if only domain name is provided

### Of course all of them can be deleted easily

### Folder structure:
#### App:
```
app/domain
└── pet_management
├── app_services
│ └── register_dog.rb
├── infrastructures
│ └── repos
│ └── dog.rb
└── services
├── models
│ └── dog.rb
└── validate_dog.rb
```
#### RSpec:
```
spec/domain
└── pet_management
├── app_services
│ └── register_dog_spec.rb
├── infrastructures
│ └── repos
│ └── dog_spec.rb
└── services
├── models
│ └── dog_spec.rb
└── validate_dog_spec.rb
```
#### A model factory to give you a starting point with [FactoryBot](http://github.com/thoughtbot/factory_bot_rails)
```
test/factories
└── Dog.rb
```
___
## TODO:
1. Generate class and spec seperately.
2. Validate arguements must be in CamelCase.
3. Generate repository class without dry stuff.
4. Depends on what's on the issue list I guess.