Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3e31b5b375 | ||
|
a5fb3aea36 | ||
|
cae4bf355e | ||
|
22fca4f68e |
@@ -1,3 +1,12 @@
|
|||||||
|
### Release v1.2
|
||||||
|
|
||||||
|
2018.09.30
|
||||||
|
|
||||||
|
- 修复 递归监听会忽略主级目录的bug
|
||||||
|
- 增加 `fileboy version`命令
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Release v1.1
|
### Release v1.1
|
||||||
|
|
||||||
2018.09.19
|
2018.09.19
|
||||||
|
33
README.md
33
README.md
@@ -1,12 +1,12 @@
|
|||||||
## 项目说明
|
## 项目说明
|
||||||
|
|
||||||
fileboy,文件变更监听通知系统,使用 GO 编写。
|
fileboy,文件变更监听通知系统,使用 Go 编写。
|
||||||
|
|
||||||
适用于 Hot Reload (典型的如开发go项目,无需每次手动执行 go build;又比如前端 node 打包) 或者 系统监控的场景。
|
适用于 Hot Reload (典型的如开发go项目,无需每次手动执行 go build;又比如前端 node 打包) 或者 系统监控的场景。
|
||||||
|
|
||||||
## 编译环境
|
## 编译环境
|
||||||
|
|
||||||
go version >=1.10
|
go version >=1.10,推荐 1.11
|
||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
@@ -17,10 +17,10 @@ go version >=1.10
|
|||||||
|
|
||||||
### 下载二进制文件
|
### 下载二进制文件
|
||||||
|
|
||||||
Github: [正式版 v1.1](https://github.com/dengsgo/fileboy/releases)
|
Github: [正式版 v1.2](https://github.com/dengsgo/fileboy/releases)
|
||||||
Gitee [正式版 v1.1](https://gitee.com/dengsgo/fileboy/releases)
|
Gitee: [正式版 v1.2](https://gitee.com/dengsgo/fileboy/releases)
|
||||||
|
|
||||||
直接下载已经编译好的对应平台二进制文件,加入系统 Path 中即可。
|
下载已经编译好的对应平台二进制文件,重命名为`fileboy`, 加入系统 Path 中即可。
|
||||||
|
|
||||||
### 源码编译
|
### 源码编译
|
||||||
|
|
||||||
@@ -102,6 +102,18 @@ command:
|
|||||||
- echo {{file}}
|
- echo {{file}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### TODO
|
||||||
|
|
||||||
|
- [x] 命令支持变量占位符
|
||||||
|
- [x] 支持多命令
|
||||||
|
- [x] 支持监听指定文件夹
|
||||||
|
- [x] 支持不监听指定文件夹
|
||||||
|
- [x] 支持监听指定后缀文件
|
||||||
|
- [ ] 支持 http 通知
|
||||||
|
- [ ] 支持冗余任务丢弃
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## QA
|
## QA
|
||||||
|
|
||||||
#### 很多框架都自带了 hot reload 的功能,为什么还要单独写个 fileboy 呢?
|
#### 很多框架都自带了 hot reload 的功能,为什么还要单独写个 fileboy 呢?
|
||||||
@@ -141,3 +153,14 @@ fileboy 目前支持 `命令 + 参数`这种形式的 command,而且 参数中
|
|||||||
#### 听说有彩蛋?
|
#### 听说有彩蛋?
|
||||||
|
|
||||||
(◡ᴗ◡✿)
|
(◡ᴗ◡✿)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 贡献者
|
||||||
|
|
||||||
|
> 排名不分先后
|
||||||
|
|
||||||
|
[@dengsgo](https://www.yoytang.com) <dengsgo@yoytang.com>
|
||||||
|
|
||||||
|
[@itwesley](https://github.com/itwesley) <wcshen1126@gmail.com>
|
||||||
|
|
||||||
|
@@ -3,6 +3,6 @@ echo build start...
|
|||||||
SET CGO_ENABLED=0
|
SET CGO_ENABLED=0
|
||||||
SET GOOS=darwin
|
SET GOOS=darwin
|
||||||
SET GOARCH=amd64
|
SET GOARCH=amd64
|
||||||
go build -ldflags "-s -w"
|
go build -ldflags "-s -w" -o fileboy-darwin-amd64.bin
|
||||||
echo build success
|
echo build success
|
||||||
pause
|
pause
|
@@ -3,6 +3,6 @@ echo build start...
|
|||||||
SET CGO_ENABLED=0
|
SET CGO_ENABLED=0
|
||||||
SET GOOS=linux
|
SET GOOS=linux
|
||||||
SET GOARCH=amd64
|
SET GOARCH=amd64
|
||||||
go build -ldflags "-s -w"
|
go build -ldflags "-s -w" -o fileboy-linux-amd64.bin
|
||||||
echo build success
|
echo build success
|
||||||
pause
|
pause
|
@@ -3,6 +3,6 @@ echo build start...
|
|||||||
SET CGO_ENABLED=0
|
SET CGO_ENABLED=0
|
||||||
SET GOOS=windows
|
SET GOOS=windows
|
||||||
SET GOARCH=amd64
|
SET GOARCH=amd64
|
||||||
go build -ldflags "-s -w"
|
go build -ldflags "-s -w" -o fileboy-windows-amd64.exe
|
||||||
echo build success
|
echo build success
|
||||||
pause
|
pause
|
15
fileboy.go
15
fileboy.go
@@ -12,6 +12,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -34,7 +35,7 @@ var (
|
|||||||
|
|
||||||
type changeFile struct {
|
type changeFile struct {
|
||||||
Name string
|
Name string
|
||||||
changed int64
|
Changed int64
|
||||||
Ext string
|
Ext string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@ func eventDispatcher(event fsnotify.Event) {
|
|||||||
}
|
}
|
||||||
go run(&changeFile{
|
go run(&changeFile{
|
||||||
Name: relativePath(projectFolder, event.Name),
|
Name: relativePath(projectFolder, event.Name),
|
||||||
changed: time.Now().UnixNano(),
|
Changed: time.Now().UnixNano(),
|
||||||
Ext: ext,
|
Ext: ext,
|
||||||
})
|
})
|
||||||
case fsnotify.Remove:
|
case fsnotify.Remove:
|
||||||
@@ -143,12 +144,14 @@ func addWatcher() {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
|
md := projectFolder + "/" + darr[0]
|
||||||
if len(darr) == 2 && darr[1] == "*" {
|
if len(darr) == 2 && darr[1] == "*" {
|
||||||
listFile(projectFolder+"/"+darr[0], func(d string) {
|
dirs = arrayUniqueAdd(dirs, md)
|
||||||
|
listFile(md, func(d string) {
|
||||||
dirs = arrayUniqueAdd(dirs, d)
|
dirs = arrayUniqueAdd(dirs, d)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
dirs = arrayUniqueAdd(dirs, projectFolder+"/"+darr[0])
|
dirs = arrayUniqueAdd(dirs, md)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,6 +231,10 @@ func parseArgs() {
|
|||||||
parseConfig()
|
parseConfig()
|
||||||
run(new(changeFile))
|
run(new(changeFile))
|
||||||
return
|
return
|
||||||
|
case "version":
|
||||||
|
fallthrough
|
||||||
|
case "v":
|
||||||
|
fmt.Println("[VERSION] Release: v1.2 filegirl: " + strconv.Itoa(Version))
|
||||||
default:
|
default:
|
||||||
fmt.Print(helpStr)
|
fmt.Print(helpStr)
|
||||||
}
|
}
|
||||||
|
2
raw.go
2
raw.go
@@ -60,6 +60,8 @@ Usage of fileboy:
|
|||||||
初始化 fileboy, 在当前目录生成 filegirl.yaml 配置文件
|
初始化 fileboy, 在当前目录生成 filegirl.yaml 配置文件
|
||||||
exec
|
exec
|
||||||
尝试运行定义的 command 命令
|
尝试运行定义的 command 命令
|
||||||
|
version
|
||||||
|
查看当前版本号
|
||||||
`
|
`
|
||||||
|
|
||||||
var englishSay = []string{
|
var englishSay = []string{
|
||||||
|
2
util.go
2
util.go
@@ -32,7 +32,7 @@ func strParseRealStr(s string, cf *changeFile) string {
|
|||||||
strings.Replace(s, "{{file}}", cf.Name, -1),
|
strings.Replace(s, "{{file}}", cf.Name, -1),
|
||||||
"{{ext}}", cf.Ext, -1,
|
"{{ext}}", cf.Ext, -1,
|
||||||
),
|
),
|
||||||
"{{changed}}", strconv.FormatInt(cf.changed, 10), -1,
|
"{{changed}}", strconv.FormatInt(cf.Changed, 10), -1,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user