cargo-luban

Crates.iocargo-luban
lib.rscargo-luban
version0.3.1
sourcesrc
created_at2019-12-03 10:01:12.847719
updated_at2019-12-16 07:04:30.163283
descriptionThis is a luban project generator
homepagehttps://github.com/luban-project/luban
repository
max_upload_size
id186101
size27,488,115
Wang Wei (thegenius)

documentation

README

crates.io LICENSE Build Status

luban

luban is a generic project generator

install

mac

brew install luban-project/luban/luban
luban --version  

linux/unix

curl https://sh.rustup.rs -sSf | sh # 1. install rust: 
cargo install cargo-luban           # 2. install luban: 
cargo luban --version               # 3. check version: 

Known Problems

OS Problem Solve
centos Could not find directory of OpenSSL yum install openssl-devel
ubuntu linker cc not found sudo apt-get install build-essential
ubuntu Could not find directory of OpenSSL sudo apt install libssl-dev & sudo apt instll pkg-config

windows

  1. install rust: following rust-lang
  2. install bullet: cargo install cargo-bullet
  3. check version: cargo bullet --version
  • please install visual studio to get the msvc compiler

usage example

# for the first time, install project template
luban install --name=bullet-spring-java-maven 

# generate project
luban fast-create --name=bullet-spring-java-maven --project=com.foo.example
cd example

# make shell executable
chmod 755 gen/gen.sh
chmod 755 run.sh

# generate code and run
./gen/gen.sh 
./run.sh

bullet-spring-java-maven模板说明

基本项目结构

root --|
    api --|  #对外提供的二方包,只能包含接口和POJO类,不能包含实现
             #后续dubbo接口/grpc接口也需要定义在这里
    app --|  #主体应用程序
        biz --| #业务逻辑层,应该只包含逻辑结构的组织
        clg --| #核心逻辑层,应该只包含核心的领域模型和逻辑,要求纯函数
        dal --| #数据操作层,mysql/redis/hbase/file等
        ext --| #外部防腐层,外部调用,mq接入等
        fun --| #通用方法层,纯函数
    gen --|  #自动代码生成的插件和配置

数据库代码生成

数据库相关的sql脚本在app/src/main/resouces/db/migration目录下
代码生成命令如下:

chmod 755 gen/gen.sh
./gen/gen.sh

项目运行

chmod 755 run.sh
./run.sh

Supported Templates

Java Spring Gradle

cargo bullet install --name=bullet-spring-java
cargo bullet create  --name=bullet-spring-java
cargo bullet build   --name=bullet-spring-java --output=out 

Java Spring Maven

cargo bullet install --name=bullet-spring-java-maven
cargo bullet create  --name=bullet-spring-java-maven
cargo bullet build   --name=bullet-spring-java-maven --output=out

MySQL accumulator

cargo bullet install --name=bullet-sql-accumulator
cargo bullet create  --name=bullet-sql-accumulator
cargo bullet build   --name=bullet-sql-accumulator --output=out 
Commit count: 0

cargo fmt