Skip to content

clean-arch-enablers-project/cae-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✔️ cae-cli

☕ Java & Kotlin edition


Welcome to the open source CAE CLI tool repository! The cae-cli is designed to make the experience of applying the cae-framework effortless. With one simple command you can generate the whole structure of a new use case in your Java or Kotlin project, already including its components throughout the application layers (core, adapters and assemblers).


State Symbol Key:

  • Under release state
  • ✔️Under snapshot state
  • Under full development state

🔧 How to install it

  1. Clone the project.
  2. Run the cae-cli-installer.exe file.
  3. Add %CAE_CLI_HOME% to your system's or user's Path environment variable.
  4. To test the installation, open a command prompt and run cae ls.

Expected result:

image


▶️ Using it

To run any command (except for new-project), you must be in the root directory of a CAE project. A CAE project is defined as a Java or Kotlin project that contains a cae-settings.json file in its root directory. The format of this file is as follows:

{
    "organization": "br.com.stockio",
    "domain": "empresas",
    "monolayer": true,
    "caeVersion": "0.11.0",
    "useCasePaths": [
        {
            "layer": "core",
            "location": "src/main/java/br/com/stockio/empresas/core/use_cases"
        },
        {
            "layer": "adapters",
            "location": "src/main/java/br/com/stockio/empresas/adapters/use_cases"
        },
        {
            "layer": "assemblers",
            "location": "src/main/java/br/com/stockio/empresas/assemblers/use_cases"
        }
    ]
}
  • organization: your groupId.
  • domain: your artifactId.
  • monolayer: if the project is structured as a single unit or divided into smaller subprojects.
  • caeVersion: cae-framework version being currently used.
  • useCasePaths: paths the CLI will use to find use cases at the core, adapters and assemblers layers.

cae new-fuc

Run this command for creating a new FunctionUseCase declaration in your CAE project.

Accepted parameters:

  • name: the name of the use case.
  • kotlin: whether or not it should be generated in Kotlin.

Expected effect:

├── core/                                                     # Core layer package
│   ├── use_cases/                                            # Use cases package 
│   │   ├── some_example/                                     # The new use case package [JUST CREATED]
│   │   │   ├── SomeExampleUseCase.java/kt                    # Abstract class for the primary port of the new use case [JUST CREATED]
│   │   │   ├── implementations/                              # Package for the implementation of the new use case [JUST CREATED]
│   │   │   │   └── SomeExampleUseCaseImplementation.java/kt  # Implementation class of the new use case [JUST CREATED]
│   │   │   ├── io/                                           # Package for the I/O declaration of the use case [JUST CREATED]
│   │   │   │   ├── inputs/                                   # Package for input classes [JUST CREATED]
│   │   │   │   │   └── SomeExampleUseCaseInput.java/kt       # Main input class for the new use case [JUST CREATED]
│   │   │   │   └── output/                                   # Package for output classes [JUST CREATED]
│   │   │   │       └── SomeExampleUseCaseOutput.java/kt      # Main output class for the new use case [JUST CREATED]

├── adapters/                                                 # Adapters layer package
│   ├── use_cases/                                            # Use cases package
│   │   └── some_example/                                     # Package for the new use case adapters (starts empty) [JUST CREATED]

├── assemblers/                                               # Assemblers layer
│   ├── use_cases/                                            # Use cases package
│   │   ├── some_example/                                     # Package for assembling the new use case [JUST CREATED]
│   │   │   └── MyUseCaseAssembler.java/kt                    # Assembler class (Factory) for the use case [JUST CREATED]

cae new-cuc

Run this command for creating a new ConsumerUseCase declaration in your CAE project.

Accepted parameters:

  • name: the name of the use case.
  • kotlin: whether or not it should be generated in Kotlin.

Expected effect:

├── core/                                                     # Core layer package
│   ├── use_cases/                                            # Use cases package
│   │   ├── some_example/                                     # The new use case package [JUST CREATED]
│   │   │   ├── SomeExampleUseCase.java/kt                    # Abstract class for the primary port of the new use case [JUST CREATED]
│   │   │   ├── implementations/                              # Package for the implementation of the new use case [JUST CREATED]
│   │   │   │   └── SomeExampleUseCaseImplementation.java/kt  # Implementation class of the new use case [JUST CREATED]
│   │   │   ├── io/                                           # Package for the I/O declaration of the use case [JUST CREATED]
│   │   │   │   ├── inputs/                                   # Package for input classes [JUST CREATED]
│   │   │   │   │   └── SomeExampleUseCaseInput.java/kt       # Main input class for the new use case [JUST CREATED]

├── adapters/                                                 # Adapters layer package
│   ├── use_cases/                                            # Use cases package
│   │   └── some_example/                                     # Package for the new use case adapters (starts empty) [JUST CREATED]

├── assemblers/                                               # Assemblers layer
│   ├── use_cases/                                            # Use cases package
│   │   ├── some_example/                                     # Package for assembling the new use case [JUST CREATED]
│   │   │   └── MyUseCaseAssembler.java/kt                    # Assembler class (Factory) for the use case [JUST CREATED]

cae new-suc

Run this command for creating a new SupplierUseCase declaration in your CAE project.

Accepted parameters:

  • name: the name of the use case.
  • kotlin: whether or not it should be generated in Kotlin.

Expected effect:

├── core/                                                     # Core layer package
│   ├── use_cases/                                            # Use cases package
│   │   ├── some_example/                                     # The new use case package [JUST CREATED]
│   │   │   ├── SomeExampleUseCase.java/kt                    # Abstract class for the primary port of the new use case [JUST CREATED]
│   │   │   ├── implementations/                              # Package for the implementation of the new use case [JUST CREATED]
│   │   │   │   └── SomeExampleUseCaseImplementation.java/kt  # Implementation class of the new use case [JUST CREATED]
│   │   │   ├── io/                                           # Package for the I/O declaration of the use case [JUST CREATED]
│   │   │   │   ├── outputs/                                  # Package for output classes [JUST CREATED]
│   │   │   │   │   └── SomeExampleUseCaseOutput.java/kt      # Main output class for the new use case [JUST CREATED]

├── adapters/                                                 # Adapters layer package
│   ├── use_cases/                                            # Use cases package
│   │   └── some_example/                                     # Package for the new use case adapters (starts empty) [JUST CREATED]

├── assemblers/                                               # Assemblers layer
│   ├── use_cases/                                            # Use cases package
│   │   ├── some_example/                                     # Package for assembling the new use case [JUST CREATED]
│   │   │   └── MyUseCaseAssembler.java/kt                    # Assembler class (Factory) for the use case [JUST CREATED]

cae new-ruc

Run this command for creating a new RunnableUseCase declaration in your CAE project.

Accepted parameters:

  • name: the name of the use case.
  • kotlin: whether or not it should be generated in Kotlin.

Expected effect:

├── core/                                                     # Core layer package
│   ├── use_cases/                                            # Use cases package
│   │   ├── some_example/                                     # The new use case package [JUST CREATED]
│   │   │   ├── SomeExampleUseCase.java/kt                    # Abstract class for the primary port of the new use case [JUST CREATED]
│   │   │   ├── implementations/                              # Package for the implementation of the new use case [JUST CREATED]
│   │   │   │   └── SomeExampleUseCaseImplementation.java/kt  # Implementation class of the new use case [JUST CREATED]

├── adapters/                                                 # Adapters layer package
│   ├── use_cases/                                            # Use cases package
│   │   └── some_example/                                     # Package for the new use case adapters (starts empty) [JUST CREATED]

├── assemblers/                                               # Assemblers layer
│   ├── use_cases/                                            # Use cases package
│   │   ├── some_example/                                     # Package for assembling the new use case [JUST CREATED]
│   │   │   └── MyUseCaseAssembler.java/kt                    # Assembler class (Factory) for the use case [JUST CREATED]

cae new-project

Run this command for creating a new CAE project.

Accepted parameters:

  • artifactId: the name of the project.
  • groupId: name of the organization which owns the project.
  • caeVersion: the desired cae-framework version.

Expected effect:

  • A monolayer project with 3 main packages: core, adapters and assemblers. Multilayer project generation is suspended via CLI.
  • A cae-settings.json file created and properly set.
  • The pom.xml file created and properly set, including the script for the autodocumentation.
  • The LoggerBootstrap.java file with default settings for the automatic logging mechanism (feel free to change it).
  • The LoggerAdapter.java file which implements the Logger interface from the framework and adapts it for the Slf4j format (feel free to change it too).
  • The ${artifactId}Documentation.java file which is invoked by the Maven Install phase due to the pom.xml settings for the autodocumentation process.

💡 Tutorials

Tutorials will soon be available on the SDK's YouTube channel: Clean Arch Enablers SDK.


🌐 Other components of the SDK:





CAE — Clean Architecture made easy.