更新 readme
This commit is contained in:
parent
86ceb19acd
commit
aa23628137
129
README.md
129
README.md
@ -2,43 +2,31 @@
|
||||
|
||||
[![Build Status](https://travis-ci.org/dengsgo/fileboy.svg?branch=master)](https://travis-ci.org/dengsgo/fileboy) [![Go Report Card](https://goreportcard.com/badge/github.com/dengsgo/fileboy)](https://goreportcard.com/report/github.com/dengsgo/fileboy)
|
||||
|
||||
[简体中文](README.md) | [ENGLISH](README_EN.md)
|
||||
|
||||
fileboy,文件变更监听通知系统,使用 Go 编写。
|
||||
适用于 Hot Reload (典型的如开发go项目,无需每次手动执行 go build;又比如前端 node 打包) 或者 系统监控的场景。
|
||||
___
|
||||
Fileboy, File Change Monitoring Notification System, written with Go.
|
||||
For Hot Reload scenarios (typically for developing go projects without having to perform go build manually every time; for example, front-end node packaging) or system monitoring.
|
||||
|
||||
|
||||
## 特性
|
||||
|
||||
- 极简的用法和配置
|
||||
- 支持多平台,Windows/Linux/MacOS
|
||||
- 支持自定义文件监听范围,监听指定文件夹/不监听指定文件夹/指定后缀文件
|
||||
- 支持自定义监控事件(write/rename/remove/create/chmod)
|
||||
- 支持设置多条命令
|
||||
- 命令支持变量占位符
|
||||
- 支持冗余任务丢弃,自定义冗余任务范围
|
||||
- 支持 http 通知
|
||||
- 更多...
|
||||
___
|
||||
- Minimalist usage and configuration
|
||||
- Support multiple platforms, Windows/Linux/MacOS
|
||||
- Supports custom file listening scope, listening for specified folders/not listening for specified folders/specified suffix files
|
||||
- Support for setting up multiple commands
|
||||
- Command support variable placeholders
|
||||
- Supporting redundant task discarding and customizing redundant task scope
|
||||
- Supporting HTTP notifications
|
||||
- more...
|
||||
|
||||
|
||||
## 编译环境
|
||||
|
||||
go version 1.12
|
||||
go version 1.13
|
||||
|
||||
## 更新日志
|
||||
|
||||
[CHANGELOG](CHANGELOG.md)
|
||||
|
||||
|
||||
## 运行
|
||||
|
||||
### 下载二进制文件
|
||||
@ -47,8 +35,6 @@ Github: [download v1.10](https://github.com/dengsgo/fileboy/releases)
|
||||
Gitee: [dowmload v1.10](https://gitee.com/dengsgo/fileboy/releases)
|
||||
|
||||
下载已经编译好的对应平台二进制文件,重命名为`fileboy`, 加入系统 Path 中即可。
|
||||
___
|
||||
Download the compiled binary file of the corresponding platform, rename it `fileboy`, and add it to the system Path.
|
||||
|
||||
### 源码编译
|
||||
|
||||
@ -62,17 +48,7 @@ go build
|
||||
## 运行
|
||||
./fileboy
|
||||
```
|
||||
___
|
||||
Clone project, enter the project directory, run the command:
|
||||
```shell
|
||||
## installation dependency
|
||||
go get-u gopkg.in/fsnotify/fsnotify.v1
|
||||
go get-u gopkg.in/yaml.v2
|
||||
## compile
|
||||
go build
|
||||
## run
|
||||
./fileboy
|
||||
```
|
||||
|
||||
## 使用
|
||||
|
||||
fileboy 的正常运行依赖于 `filegirl.yaml` 配置,所以首次在项目中使用需要初始化 `filegirl.yaml`。
|
||||
@ -83,15 +59,6 @@ fileboy 的正常运行依赖于 `filegirl.yaml` 配置,所以首次在项目
|
||||
|
||||
如果你定义了 `command -> exec`命令,想事先确认是否能正常执行,可以运行 `fileboy exec`命令,系统会尝试运行你的自定义命令。
|
||||
你可以使用 `fileboy help`查看使用帮助。
|
||||
___
|
||||
The normal operation of fileboy depends on the `filegirl.yaml` configuration, so for the first time in a project, `filegirl.yaml` needs to be initialized.
|
||||
- Enter the project home directory where you want hot reload;
|
||||
- Running `fileboy init` will generate `filegirl. yaml` files in this directory.
|
||||
- View `filegirl. yaml` and modify it to a configuration item suitable for your project.
|
||||
- Run `fileboy`.
|
||||
|
||||
If you define the `command-> exec` command, you can run the `fileboy exec` command to confirm whether it can be executed properly in advance. The system will try to run your custom command.
|
||||
You can use `fileboy help` to see help info.
|
||||
|
||||
## filegirl.yaml 配置文件说明
|
||||
|
||||
@ -126,6 +93,20 @@ monitor:
|
||||
types:
|
||||
- .go
|
||||
|
||||
# 监听的事件类型,发生此类事件才执行 command 中的命令
|
||||
# 没有该配置默认监听所有事件
|
||||
# write 写入文件事件
|
||||
# rename 重命名文件事件
|
||||
# remove 移除文件事件
|
||||
# create 创建文件事件
|
||||
# chmod 更新文件权限事件(类unix)
|
||||
events:
|
||||
- write
|
||||
- rename
|
||||
- remove
|
||||
- create
|
||||
- chmod
|
||||
|
||||
# 命令
|
||||
command:
|
||||
# 监听的文件有更改会执行的命令
|
||||
@ -161,69 +142,6 @@ notifier:
|
||||
# 不启用通知,请留空 ""
|
||||
callUrl: ""
|
||||
```
|
||||
___
|
||||
```yaml
|
||||
core:
|
||||
# config version code
|
||||
version: 1
|
||||
|
||||
# monitor section
|
||||
monitor:
|
||||
# directories to monitor
|
||||
# test1 listen for the test1 directory in the project directory
|
||||
# test1/test2 listen for the test1/test2 directory in the project directory
|
||||
# test1,* listen for the test1 directory in the project directory and all its subdirectories (recursion)
|
||||
# .,* listen for the project directory and all its subdirectories (recursion)
|
||||
includeDirs:
|
||||
- .,*
|
||||
|
||||
# Unmonitored directories
|
||||
# .idea ignore listening to .idea directory and all its subdirectories
|
||||
exceptDirs:
|
||||
- .idea
|
||||
- .git
|
||||
- .vscode
|
||||
- node_modules
|
||||
- vendor
|
||||
|
||||
# the suffix of the listener file, which changes the file to execute commands
|
||||
# .go file changes suffixed with .go execute commands
|
||||
# .* all file changes execute commands in the command
|
||||
types:
|
||||
- .go
|
||||
|
||||
command:
|
||||
# the files monitored have commands that change to be executed
|
||||
# there can be multiple commands that will be executed in turn
|
||||
# in case of interactive commands, allow external access to input
|
||||
# variable placeholders are supported, and the actual values are replaced when the command is run:
|
||||
# {{file}} (e.g: a.txt 、test/test2/a.go)
|
||||
# {{ext}} (e.g: .go)
|
||||
# {{changed}} local timestamp for file updated(nanosecond,e.g 1537326690523046400)
|
||||
# variable placeholders e.g:cp {{file}} /root/sync -rf 、 myCommand --{{ext}} {{changed}}
|
||||
exec:
|
||||
- go version
|
||||
- go env
|
||||
|
||||
# the command will not execute until XX milliseconds after the file changes
|
||||
# a change event (A) cancels execution if there is a new file change event (B) within the defined delay time (t).
|
||||
# B and subsequent events are analogized in turn until event Z does not produce new events within t, and Z executes.
|
||||
# reasonable setting of delay time will effectively reduce redundancy and duplicate task execution.
|
||||
# If this feature is not required, set to 0
|
||||
delayMillSecond: 2000
|
||||
|
||||
notifier:
|
||||
# file changes send requests to the URL (POST JSON text data)
|
||||
# the timing of triggering the request is consistent with executing the command command
|
||||
# timeout 15 second
|
||||
# POST :
|
||||
# Content-Type: application/json;charset=UTF-8
|
||||
# User-Agent: FileBoy Net Notifier v1.10
|
||||
# Body: {"project_folder":"/watcher-dirs","file":"test.go","changed":1546421173070433800,"ext":".go"}
|
||||
# e.g: http://example.com/notifier/fileboy-listener
|
||||
# no notice is enabled. Please leave it blank. ""
|
||||
callUrl: ""
|
||||
```
|
||||
|
||||
### TODO
|
||||
|
||||
@ -235,15 +153,6 @@ notifier:
|
||||
- [x] 支持 http 通知
|
||||
- [x] 支持冗余任务丢弃
|
||||
- [ ] 支持 http 合并任务的通知
|
||||
___
|
||||
- [x] command supports variable placeholders
|
||||
- [x] Supports multiple commands
|
||||
- [x] Supports listening for specified folders
|
||||
- [x] Supports not listening to specified folders
|
||||
- [x] Supports listening for specified suffix files
|
||||
- [x] Supports HTTP notifications
|
||||
- [x] Supports redundant task discarding
|
||||
- [ ] Notification supporting HTTP merge tasks
|
||||
|
||||
## QA
|
||||
|
||||
|
149
README_EN.md
Normal file
149
README_EN.md
Normal file
@ -0,0 +1,149 @@
|
||||
## FILEBOY
|
||||
|
||||
[![Build Status](https://travis-ci.org/dengsgo/fileboy.svg?branch=master)](https://travis-ci.org/dengsgo/fileboy) [![Go Report Card](https://goreportcard.com/badge/github.com/dengsgo/fileboy)](https://goreportcard.com/report/github.com/dengsgo/fileboy)
|
||||
|
||||
[简体中文](README.md) | [ENGLISH](README_EN.md)
|
||||
|
||||
Fileboy, File Change Monitoring Notification System, written with Go.
|
||||
For Hot Reload scenarios (typically for developing go projects without having to perform go build manually every time; for example, front-end node packaging) or system monitoring.
|
||||
|
||||
## FEATURES
|
||||
|
||||
- Minimalist usage and configuration
|
||||
- Support multiple platforms, Windows/Linux/MacOS
|
||||
- Supports custom file listening scope, listening for specified folders/not listening for specified folders/specified suffix files
|
||||
- Support for custom monitoring events (write / rename / remove / create / chmod)
|
||||
- Support for setting up multiple commands
|
||||
- Command support variable placeholders
|
||||
- Supporting redundant task discarding and customizing redundant task scope
|
||||
- Supporting HTTP notifications
|
||||
- more...
|
||||
|
||||
## COMPILE
|
||||
|
||||
go version 1.13
|
||||
|
||||
## CHANGELOG
|
||||
|
||||
[CHANGELOG](CHANGELOG.md)
|
||||
|
||||
|
||||
## RUN
|
||||
|
||||
### BINARIES
|
||||
|
||||
Github: [download v1.10](https://github.com/dengsgo/fileboy/releases)
|
||||
Gitee: [dowmload v1.10](https://gitee.com/dengsgo/fileboy/releases)
|
||||
|
||||
Download the compiled binary file of the corresponding platform, rename it `fileboy`, and add it to the system Path.
|
||||
|
||||
### SOURCE
|
||||
|
||||
Clone project, enter the project directory, run the command:
|
||||
```shell
|
||||
## installation dependency
|
||||
go get-u gopkg.in/fsnotify/fsnotify.v1
|
||||
go get-u gopkg.in/yaml.v2
|
||||
## compile
|
||||
go build
|
||||
## run
|
||||
./fileboy
|
||||
```
|
||||
## USAGE
|
||||
|
||||
The normal operation of fileboy depends on the `filegirl.yaml` configuration, so for the first time in a project, `filegirl.yaml` needs to be initialized.
|
||||
- Enter the project home directory where you want hot reload;
|
||||
- Running `fileboy init` will generate `filegirl. yaml` files in this directory.
|
||||
- View `filegirl. yaml` and modify it to a configuration item suitable for your project.
|
||||
- Run `fileboy`.
|
||||
|
||||
If you define the `command-> exec` command, you can run the `fileboy exec` command to confirm whether it can be executed properly in advance. The system will try to run your custom command.
|
||||
You can use `fileboy help` to see help info.
|
||||
|
||||
## filegirl.yaml
|
||||
|
||||
```yaml
|
||||
core:
|
||||
# config version code
|
||||
version: 1
|
||||
|
||||
# monitor section
|
||||
monitor:
|
||||
# directories to monitor
|
||||
# test1 listen for the test1 directory in the project directory
|
||||
# test1/test2 listen for the test1/test2 directory in the project directory
|
||||
# test1,* listen for the test1 directory in the project directory and all its subdirectories (recursion)
|
||||
# .,* listen for the project directory and all its subdirectories (recursion)
|
||||
includeDirs:
|
||||
- .,*
|
||||
|
||||
# Unmonitored directories
|
||||
# .idea ignore listening to .idea directory and all its subdirectories
|
||||
exceptDirs:
|
||||
- .idea
|
||||
- .git
|
||||
- .vscode
|
||||
- node_modules
|
||||
- vendor
|
||||
|
||||
# the suffix of the listener file, which changes the file to execute commands
|
||||
# .go file changes suffixed with .go execute commands
|
||||
# .* all file changes execute commands in the command
|
||||
types:
|
||||
- .go
|
||||
|
||||
# the type of event to listen to. Only when such an event occurs can the command in command be executed
|
||||
# without this configuration, all events will be monitored by default
|
||||
# write write file event
|
||||
# rename rename file event
|
||||
# remove remove remove file event
|
||||
# create create file event
|
||||
# chmod update file permission event (UNIX like)
|
||||
events:
|
||||
- write
|
||||
- rename
|
||||
- remove
|
||||
- create
|
||||
- chmod
|
||||
|
||||
command:
|
||||
# the files monitored have commands that change to be executed
|
||||
# there can be multiple commands that will be executed in turn
|
||||
# in case of interactive commands, allow external access to input
|
||||
# variable placeholders are supported, and the actual values are replaced when the command is run:
|
||||
# {{file}} (e.g: a.txt 、test/test2/a.go)
|
||||
# {{ext}} (e.g: .go)
|
||||
# {{changed}} local timestamp for file updated(nanosecond,e.g 1537326690523046400)
|
||||
# variable placeholders e.g:cp {{file}} /root/sync -rf 、 myCommand --{{ext}} {{changed}}
|
||||
exec:
|
||||
- go version
|
||||
- go env
|
||||
|
||||
# the command will not execute until XX milliseconds after the file changes
|
||||
# a change event (A) cancels execution if there is a new file change event (B) within the defined delay time (t).
|
||||
# B and subsequent events are analogized in turn until event Z does not produce new events within t, and Z executes.
|
||||
# reasonable setting of delay time will effectively reduce redundancy and duplicate task execution.
|
||||
# If this feature is not required, set to 0
|
||||
delayMillSecond: 2000
|
||||
|
||||
notifier:
|
||||
# file changes send requests to the URL (POST JSON text data)
|
||||
# the timing of triggering the request is consistent with executing the command command
|
||||
# timeout 15 second
|
||||
# POST :
|
||||
# Content-Type: application/json;charset=UTF-8
|
||||
# User-Agent: FileBoy Net Notifier v1.10
|
||||
# Body: {"project_folder":"/watcher-dirs","file":"test.go","changed":1546421173070433800,"ext":".go"}
|
||||
# e.g: http://example.com/notifier/fileboy-listener
|
||||
# no notice is enabled. Please leave it blank. ""
|
||||
callUrl: ""
|
||||
```
|
||||
|
||||
### CONTRIBUTOR
|
||||
|
||||
[@dengsgo](https://www.yoytang.com) <dengsgo@gmail.com>
|
||||
|
||||
[@itwesley](https://github.com/itwesley) <wcshen1126@gmail.com>
|
||||
|
||||
[@jason-gao](https://github.com/jason-gao) <3048789891@qq.com>
|
||||
|
Loading…
Reference in New Issue
Block a user