简介
看这个title宅男们可能要想歪了,其实不然,在查看grafana源码的时候发现该开源软件使用了一个工具bra。本文就分析一下grafana下如何使用bra工具
工作流程
-
make run
启动应用,调用Makefile文件下run命令 -
@GO111MODULE=on scripts/go/bin/bra run
命令,根据配置文件.bra.toml
,启动应用 - 后续watch_dirs下内的文件有如有变化,bra命令则自动的重新执行编译重启
详细脚本分解
-
make run
启动应用,调用Makefile文件下run命令
run: scripts/go/bin/bra ## Build and run web server on filesystem changes.
@GO111MODULE=on scripts/go/bin/bra run
-
@GO111MODULE=on scripts/go/bin/bra run
命令,根据配置文件.bra.toml
,启动应用
[run] # Commands run in start
init_cmds = [
["go", "run", "build.go", "-dev", "build-cli"],
["go", "run", "build.go", "-dev", "build-server"],
["./bin/grafana-server", "-packaging=dev", "cfg:app_mode=development"]
]
watch_all = true # 是否监听所有子目录
follow_symlinks = true
watch_dirs = [ # 需要监听的目录
"$WORKDIR/pkg",
"$WORKDIR/public/views",
"$WORKDIR/conf",
]
watch_exts = [".go", ".ini", ".toml", ".template.html"] ## 需要监听的扩展文件
build_delay = 1500
cmds = [ # 执行的运行命令
["go", "run", "build.go", "-dev", "build-server"],
["./bin/grafana-server", "-packaging=dev", "cfg:app_mode=development"]
]
- 后续watch_dirs下内的文件有如有变化,bra命令则自动的重新执行编译重启(cmds下的命令)
网友评论