bullet is a project boilerplate generator
- install rust: curl https://sh.rustup.rs -sSf | sh
- install bullet: cargo install cargo-bullet
- check version: cargo bullet --version
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 |
- install rust: following rust-lang
- install bullet: cargo install cargo-bullet
- check version: cargo bullet --version
- please install visual studio to get the msvc compiler
- install rust
- git clone https://github.com/thegenius/bullet.git
- cd bullet
- cargo build --release
- ./target/release/bullet.exe --version
cargo bullet --config=<config_file> --template=<template_dir> --out=<out_dir>
group = "example"
project = "test"
[ext]
my_content = "This is my content"
project_structure = [
{item_path="{{ context.group }}.{{context.project }}", item_file = "hello.txt", item_tmpl="hello.txt.tmpl", item_type="static"}
]
hello {{ context.project }} {{ context.ext.my_content }}
cargo bullet -c build.toml -t templates -o output
when we develop a project, we always write many boilerplate code, config and etc. so to save your life time.
- create a project template.
- config the project with yaml or json or toml.
- generate the project
root |-- structure/
|-- |-- structure.toml
|-- template/
|-- |-- hello.tmpl
|-- |-- world.tmpl
|-- bullet.toml
- project_structure is the root element
- children element must have 4 fields: item_path, item_file, item_tmpl, item_type
- item_path is the file path that you want to generate
- item_file is the file name that you want to generate
- item_tmpl is the template file located in template dir
- item_type now support "static" and "dynamic"
you can use context as the reference to bullet.toml properties
for example:
item_path = "{{context.project}}.hello"
you can use context as the reference to bullet.toml properties,
and you can use resource as the reference to bullet.toml's resource item
for example:
item_path = "{{context.project}}.hello" item_file = "{{resource.name_info.default_name}}"
group = "example"
project = "test"
[ext]
content = "ext content"
[resources.basic_info]
name_info = {default_name = "hello"}
type_info = {}
ext = {}
fields = [
{name_info = {default_name = "id", camel_name="id"}, type_info= {java="Long"}},
]
property | must | type |
---|---|---|
group | yes | string |
project | yes | string |
ext | no | map<string, string> |
resources | no | resource element |
property | must | type |
---|---|---|
name_info | yes | name element |
type_info | yes | map<string, string> |
ext | no | map<string, string> |
fields | yes | field element |
property | must | type |
---|---|---|
name_info | yes | name element |
type_info | yes | map<string, string> |
ext | no | map<string, string> |
property | must | type |
---|---|---|
default_name | yes | string |
snake_name | no | string |
hyphen_name | no | string |
upper_camel_name | no | string |
lower_camel_name | no | string |
cargo bullet install --name=bullet-spring-java
cargo bullet create --name=bullet-spring-java
cargo bullet build --name=bullet-spring-java --output=out
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
cargo bullet install --name=bullet-sql-accumulator
cargo bullet create --name=bullet-sql-accumulator
cargo bullet build --name=bullet-sql-accumulator --output=out