6 releases

0.3.1 Dec 16, 2019
0.3.0 Dec 16, 2019
0.2.9 Dec 13, 2019

#2930 in Command line utilities

Apache-2.0/MIT

10MB
1K SLoC

Contains (DOS exe, 5.5MB) distribute/windows/luban.exe, (Mach-o exe, 5MB) distribute/darwin/0.2.6/luban, (Mach-o exe, 5MB) distribute/darwin/0.2.7/luban, (Mach-o exe, 5MB) distribute/darwin/0.2.9/luban, (Mach-o exe, 5MB) distribute/darwin/0.3.0/luban

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 

Dependencies

~24–36MB
~632K SLoC