A simple project files watcher and deployer, which syncs dev files to remote machines at ease.
go-van is the Go implementation of Caravan.
This is the caravan in Sid Meier's Civilization V, where the project name originally comes from.
Compared to Ruby version of Caravan:
- It highly depends on
caravan.yml, which assumes thatcaravan.ymlis already setup. - Only
rsyncis supported. - More powerful features (e.g.
extra_argsandlog_format).
go get -u github.com/crispgm/go-van-
Init
caravan.yml:$ go-van -init Created caravan.yml in /path/to/project -
Edit
caravan.yml:# Open with your favorite editor, `vim` for example $ vim caravan.ymlSpecify
src,dst, and other configuration inmasterscope:--- master: src: . dst: user@target:/path/to/project debug: false deploy_mode: rsync incremental: true extra_args: - "--delete" - "--exclude=.git" exclude: - ".git"
-
Start to watch:
$ go-van Reading configuration... => debug: false => once: false => source: . => destination: . => deploy_mode: rsync => incremental: true => extra_args: [--delete] => exclude: [.git .svn /node_modules] Starting to watch...
-
When a file is changed, it syncs:
[20:46:05] EVENT 0x41217e0 /Users/david/path/to/file.py
Generate an empty caravan.yml:
$ go-van -init
Created caravan.yml in /path/to/projectRun with default:
# Default run, with `caravan.yml` and `master` spec
$ go-vanAnd you may specify config file name and spec name:
# Special spec name
$ go-van -spec my_spec
# Specify config file name
$ go-van -conf another_caravan.yml
# And both
$ go-van -conf another_caravan.yml -spec my_specDeploy once:
$ go-van -once
Reading configuration...
=> debug: false
...
Deploying at once and for once...Show debug outputs.
Only support rsync in go-van, compared to caravan.
Exclusion denotes exclude path for watching, not deploying. Hence, use git/svn in source path instead of destination path or checkout Extra Arguments.
Extra arguments will be passed to deployer (e.g. rsync) as arguments.
master:
src: .
dst: /path/to/project
debug: false
deploy_mode: rsync
incremental: true
extra_args:
- "--delete"
exclude:
- ".git"
- ".svn"extra_args:
- "--exclude=.git"Format:
%t: Time string, e.g. 16:25:01%T: Timestamp%e: Event type%p: Path%f: File name
log_format: "[%t] EVENT <%e> %p"Event hooks are designed to handle events of hooks, by which users may inject their scripts.
There are four hooks exposed, which are OnInit OnChange OnDeploy OnError.
e.g., You may add OnInit in caravan.yml:
on_init:
- echo "go-van is initializing"
on_change:
- makeMIT License.
Copyright (c) 2020 David Zhang.