files watcher fixed
This commit is contained in:
parent
d139177158
commit
e0e72325a4
|
@ -107,6 +107,7 @@ func (r *realize) Wdir() string {
|
|||
|
||||
func (r *realize) Serve(p *cli.Context) {
|
||||
if !p.Bool("no-server") {
|
||||
fmt.Println(r.Red(r.Host) + "\n")
|
||||
r.Server.Open = p.Bool("open")
|
||||
r.Server.Start()
|
||||
}
|
||||
|
@ -137,12 +138,7 @@ func (r *realize) List(p *cli.Context) error {
|
|||
|
||||
func (r *realize) Before(p *cli.Context) error {
|
||||
fmt.Println(r.Blue(r.Name) + " - " + r.Blue(r.Version))
|
||||
if !p.Bool("no-server") {
|
||||
fmt.Println(r.BlueS(r.Description))
|
||||
fmt.Println(r.Red(r.Host) + "\n")
|
||||
} else {
|
||||
fmt.Println(r.BlueS(r.Description) + "\n")
|
||||
}
|
||||
fmt.Println(r.BlueS(r.Description) + "\n")
|
||||
gopath := os.Getenv("GOPATH")
|
||||
if gopath == "" {
|
||||
log.Fatal(r.Red("$GOPATH isn't set up properly"))
|
||||
|
|
|
@ -20,6 +20,10 @@ func (p *Project) watching() {
|
|||
var wr sync.WaitGroup
|
||||
var watcher *fsnotify.Watcher
|
||||
|
||||
sync := func() {
|
||||
p.parent.Sync <- "sync"
|
||||
}
|
||||
|
||||
watcher, err := fsnotify.NewWatcher()
|
||||
if err != nil {
|
||||
log.Println(strings.ToUpper(pname(p.Name, 1)), ":", Red(err.Error()))
|
||||
|
@ -64,7 +68,7 @@ func (p *Project) watching() {
|
|||
i := strings.Index(event.Name, filepath.Ext(event.Name))
|
||||
if event.Name[:i] != "" && inArray(ext, p.Watcher.Exts) {
|
||||
p.Buffer.StdLog = append(p.Buffer.StdLog, BufferOut{Time: time.Now(), Text: strings.ToUpper(ext[1:]) + " changed " + event.Name[:i] + ext})
|
||||
p.parent.Sync <- "sync"
|
||||
go sync()
|
||||
fmt.Println(pname(p.Name, 4), Magenta(strings.ToUpper(ext[1:])+" changed"), Magenta(event.Name[:i]+ext))
|
||||
// stop and run again
|
||||
if p.Run {
|
||||
|
|
Loading…
Reference in New Issue