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) {
|
func (r *realize) Serve(p *cli.Context) {
|
||||||
if !p.Bool("no-server") {
|
if !p.Bool("no-server") {
|
||||||
|
fmt.Println(r.Red(r.Host) + "\n")
|
||||||
r.Server.Open = p.Bool("open")
|
r.Server.Open = p.Bool("open")
|
||||||
r.Server.Start()
|
r.Server.Start()
|
||||||
}
|
}
|
||||||
@ -137,12 +138,7 @@ func (r *realize) List(p *cli.Context) error {
|
|||||||
|
|
||||||
func (r *realize) Before(p *cli.Context) error {
|
func (r *realize) Before(p *cli.Context) error {
|
||||||
fmt.Println(r.Blue(r.Name) + " - " + r.Blue(r.Version))
|
fmt.Println(r.Blue(r.Name) + " - " + r.Blue(r.Version))
|
||||||
if !p.Bool("no-server") {
|
fmt.Println(r.BlueS(r.Description) + "\n")
|
||||||
fmt.Println(r.BlueS(r.Description))
|
|
||||||
fmt.Println(r.Red(r.Host) + "\n")
|
|
||||||
} else {
|
|
||||||
fmt.Println(r.BlueS(r.Description) + "\n")
|
|
||||||
}
|
|
||||||
gopath := os.Getenv("GOPATH")
|
gopath := os.Getenv("GOPATH")
|
||||||
if gopath == "" {
|
if gopath == "" {
|
||||||
log.Fatal(r.Red("$GOPATH isn't set up properly"))
|
log.Fatal(r.Red("$GOPATH isn't set up properly"))
|
||||||
|
@ -20,6 +20,10 @@ func (p *Project) watching() {
|
|||||||
var wr sync.WaitGroup
|
var wr sync.WaitGroup
|
||||||
var watcher *fsnotify.Watcher
|
var watcher *fsnotify.Watcher
|
||||||
|
|
||||||
|
sync := func() {
|
||||||
|
p.parent.Sync <- "sync"
|
||||||
|
}
|
||||||
|
|
||||||
watcher, err := fsnotify.NewWatcher()
|
watcher, err := fsnotify.NewWatcher()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(strings.ToUpper(pname(p.Name, 1)), ":", Red(err.Error()))
|
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))
|
i := strings.Index(event.Name, filepath.Ext(event.Name))
|
||||||
if event.Name[:i] != "" && inArray(ext, p.Watcher.Exts) {
|
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.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))
|
fmt.Println(pname(p.Name, 4), Magenta(strings.ToUpper(ext[1:])+" changed"), Magenta(event.Name[:i]+ext))
|
||||||
// stop and run again
|
// stop and run again
|
||||||
if p.Run {
|
if p.Run {
|
||||||
|
Loading…
Reference in New Issue
Block a user