#!/usr/bin/env bash #------------------------------------------------- # 命令脚本 # @author lwt #------------------------------------------------- # 生成启动脚本 DOC[gen_start]="生成启动脚本" fun_gen_start(){ INFO "执行命令:rebar3 auto_config compile" INFO "生成\e[92m启动脚本\e[0;0m..." cd ${ROOT} ${REBAR} auto_config compile } # 生成模板 DOC[gen_mod]="生成功能模板,参数:功能名" fun_gen_mod(){ INFO "执行命令:rebar3 gen_mod compile -m ${1}" INFO "生成\e[92m${1}\e[0;0m功能模板..." cd ${ROOT} ${REBAR} gen_mod compile -m $1 } # 生成数据 DOC[gen_data]="生成数据" fun_gen_data(){ INFO "执行命令:rebar3 gen_data data -m ${1}" INFO "生成\e[92m${1}\e[0;0m数据..." ${REBAR} gen_data data -m ${1} } # 生成数据 DOC[gen_cfg]="生成数据模板" fun_gen_cfg(){ INFO "执行命令:rebar3 gen_data cfg -m ${1}" INFO "生成\e[92m${1}\e[0;0m数据模板..." ${REBAR} gen_data cfg -m ${1} } # 生成数据 DOC[gen_tpl]="生成配置表" fun_gen_tpl(){ INFO "执行命令:rebar3 gen_data tpl -m ${1}" INFO "生成\e[92m${1}\e[0;0m配置表..." ${REBAR} gen_data tpl -m ${1} } # 生成日志文件 DOC[gen_tbllog]="生成日志文件" fun_gen_tbllog(){ INFO "执行命令:rebar3 tbllog compile" INFO "生成日志文件..." ${REBAR} tbllog compile } # 生成协议文件 DOC[gen_proto]="生成协议相关文件" fun_gen_proto(){ INFO "执行命令:rebar3 protobuf compile -a ${DEF_SERVER}" INFO "正在生成协议相关文件..." ${REBAR} protobuf clean -a ${DEF_SERVER} ${REBAR} protobuf compile -a ${DEF_SERVER} } # 生成数据文件 DOC[gen_cache]="生成数据文件" fun_gen_cache(){ INFO "执行命令:rebar3 cache compile" INFO "生成数据文件..." ${REBAR} cache clean -a ${DEF_SERVER} ${REBAR} cache compile ${REBAR} tbllog clean -a ${DEF_SERVER} ${REBAR} tbllog compile }