8000 GitHub - gogovan/domain-generator: A gem that reduce boilerplates when creating new domain services
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gogovan/domain-generator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Rails generator for Domain-driven design application

Demo

Currently supporting Rails 3.2.0 or above

How to use

  1. Install:
$ gem install domain-generator
  1. Gemfile:
gem 'domain-generator', '~> 0.1.0'
  1. Or building the gem by yourself:
$ gem build domain-generator.gemspec
  1. Try it out:
$ rails generate domain [DOMAIN_NAME] [options]

Options

  1. --include-dry | --no-include-dry
    • Generate class and spec with or without dry-monads
  2. --repo | --no-repo
    • Should / Should not 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

All

To generate model without repository

No Repo

You can also just generate a particular class and spec

App Service

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

Nothing

Of course all of them can be deleted easily

Delete

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 pretty basic foundation with FactoryBot

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.

About

A gem that reduce boilerplates when creating new domain services

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%
0