Rails generator for Domain-driven design application
Supporting Rails 3.2.0 or above
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
--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
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
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.