修改 changeFile->changedFile
This commit is contained in:
parent
3ffa24d4fa
commit
4f6d1bd68c
@ -26,7 +26,7 @@ var (
|
||||
taskMan *TaskMan
|
||||
)
|
||||
|
||||
type changeFile struct {
|
||||
type changedFile struct {
|
||||
Name string
|
||||
Changed int64
|
||||
Ext string
|
||||
@ -60,7 +60,7 @@ func eventDispatcher(event fsnotify.Event) {
|
||||
case fsnotify.Create:
|
||||
case fsnotify.Write:
|
||||
log.Println("event write : ", event.Name)
|
||||
taskMan.Put(&changeFile{
|
||||
taskMan.Put(&changedFile{
|
||||
Name: relativePath(projectFolder, event.Name),
|
||||
Changed: time.Now().UnixNano(),
|
||||
Ext: ext,
|
||||
@ -176,7 +176,7 @@ func parseArgs() {
|
||||
return
|
||||
case "exec":
|
||||
parseConfig()
|
||||
newTaskMan(0, cfg.Notifier.CallUrl).run(new(changeFile))
|
||||
newTaskMan(0, cfg.Notifier.CallUrl).run(new(changedFile))
|
||||
return
|
||||
case "version", "v", "-v", "--version":
|
||||
fmt.Println(versionDesc)
|
||||
|
@ -32,7 +32,7 @@ func newNetNotifier(callUrl string) *NetNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *NetNotifier) Put(cf *changeFile) {
|
||||
func (n *NetNotifier) Put(cf *changedFile) {
|
||||
if !n.CanPost {
|
||||
log.Println("notifier call url ignore. ", n.CallUrl)
|
||||
return
|
||||
|
@ -26,7 +26,7 @@ func newTaskMan(delay int, callUrl string) *TaskMan {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TaskMan) Put(cf *changeFile) {
|
||||
func (t *TaskMan) Put(cf *changedFile) {
|
||||
if t.delay < 1 {
|
||||
t.preRun(cf)
|
||||
return
|
||||
@ -43,7 +43,7 @@ func (t *TaskMan) Put(cf *changeFile) {
|
||||
}()
|
||||
}
|
||||
|
||||
func (t *TaskMan) preRun(cf *changeFile) {
|
||||
func (t *TaskMan) preRun(cf *changedFile) {
|
||||
if t.cmd != nil {
|
||||
err := t.cmd.Process.Kill()
|
||||
if err != nil {
|
||||
@ -54,7 +54,7 @@ func (t *TaskMan) preRun(cf *changeFile) {
|
||||
go t.run(cf)
|
||||
}
|
||||
|
||||
func (t *TaskMan) run(cf *changeFile) {
|
||||
func (t *TaskMan) run(cf *changedFile) {
|
||||
go t.notifier.Put(cf)
|
||||
t.runLock.Lock()
|
||||
defer t.runLock.Unlock()
|
||||
|
4
util.go
4
util.go
@ -15,7 +15,7 @@ func inStringArray(value string, arr []string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func cmdParse2Array(s string, cf *changeFile) []string {
|
||||
func cmdParse2Array(s string, cf *changedFile) []string {
|
||||
a := strings.Split(s, " ")
|
||||
r := make([]string, 0)
|
||||
for i := 0; i < len(a); i++ {
|
||||
@ -26,7 +26,7 @@ func cmdParse2Array(s string, cf *changeFile) []string {
|
||||
return r
|
||||
}
|
||||
|
||||
func strParseRealStr(s string, cf *changeFile) string {
|
||||
func strParseRealStr(s string, cf *changedFile) string {
|
||||
return strings.Replace(
|
||||
strings.Replace(
|
||||
strings.Replace(s, "{{file}}", cf.Name, -1),
|
||||
|
Loading…
Reference in New Issue
Block a user