- Install:
$ gem install domain-generator
- Gemfile:
gem 'domain-generator', '~> 0.1.0'
- Build the gem yourself:
$ gem build domain-generator.gemspec
- Try it out:
$ rails generate domain [DOMAIN_NAME] [options]
--include-dry
|--no-include-dry
- Generate class and spec with dry-monads
--repo
|--no-repo
- Generate repository class for the model
--app-service
- Generate the application service class
--service
- Generate the service class
--model
- Generate the Entity / Model class
app/domain
└── pet_management
├── app_services
│ └── register_dog.rb
├── infrastructures
│ └── repos
│ └── dog.rb
└── services
├── models
│ └── dog.rb
└── validate_dog.rb
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
test/factories
└── Dog.rb
- Generate class and spec seperately.
- Validate arguements must be in CamelCase.
- Generate repository class without dry stuff.
- Depends on what's on the issue list I guess.