This commit is contained in:
alessio 2016-08-18 01:35:37 +02:00
parent d0a68bb541
commit 2105eff1e0
5 changed files with 96 additions and 98 deletions

View File

@ -1,9 +1,9 @@
package main package main
import ( import (
"os"
"gopkg.in/urfave/cli.v2"
r "github.com/tockins/realize/realize" r "github.com/tockins/realize/realize"
"gopkg.in/urfave/cli.v2"
"os"
) )
func main() { func main() {

View File

@ -1,10 +1,10 @@
package realize package realize
import ( import (
"github.com/fatih/color"
"sync"
"fmt" "fmt"
"github.com/fatih/color"
"log" "log"
"sync"
) )
const ( const (
@ -61,4 +61,3 @@ func (app *App) Information() {
fmt.Println(blue(app.Name) + " - " + blue(app.Version)) fmt.Println(blue(app.Name) + " - " + blue(app.Version))
fmt.Println(bluel(app.Description) + "\n") fmt.Println(bluel(app.Description) + "\n")
} }

View File

@ -1,12 +1,12 @@
package realize package realize
import ( import (
"os"
"gopkg.in/yaml.v2"
"errors" "errors"
"gopkg.in/urfave/cli.v2"
"io/ioutil"
"fmt" "fmt"
"gopkg.in/urfave/cli.v2"
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
) )
type Config struct { type Config struct {
@ -169,5 +169,3 @@ func (h *Config) List() error {
return err return err
} }
} }

View File

@ -1,14 +1,14 @@
package realize package realize
import ( import (
"time"
"os/exec"
"os"
"bytes"
"bufio" "bufio"
"bytes"
"log" "log"
"sync" "os"
"os/exec"
"strings" "strings"
"sync"
"time"
) )
type Project struct { type Project struct {
@ -107,4 +107,3 @@ func (p *Project) GoInstall() error {
} }
return nil return nil
} }

View File

@ -1,14 +1,14 @@
package realize package realize
import ( import (
"github.com/fsnotify/fsnotify"
"fmt" "fmt"
"path/filepath" "github.com/fsnotify/fsnotify"
"os"
"strings"
"log" "log"
"time" "os"
"path/filepath"
"strings"
"sync" "sync"
"time"
) )
type Watcher struct { type Watcher struct {
@ -41,12 +41,12 @@ func (p *Project) Watching() {
var wr sync.WaitGroup var wr sync.WaitGroup
var watcher *fsnotify.Watcher var watcher *fsnotify.Watcher
watcher, err := fsnotify.NewWatcher() watcher, err := fsnotify.NewWatcher()
if(err != nil){ if err != nil {
Fail(p.Name + ": \t" + err.Error()) Fail(p.Name + ": \t" + err.Error())
} }
channel := make(chan bool, 1) channel := make(chan bool, 1)
base, err := os.Getwd() base, err := os.Getwd()
if(err != nil){ if err != nil {
Fail(p.Name + ": \t" + err.Error()) Fail(p.Name + ": \t" + err.Error())
} }
@ -66,7 +66,9 @@ func (p *Project) Watching() {
routines := func() { routines := func() {
channel = make(chan bool) channel = make(chan bool)
wr.Add(1) wr.Add(1)
go p.build(); p.install(); p.run(channel, &wr); go p.build()
p.install()
p.run(channel, &wr)
} }
end := func() { end := func() {
watcher.Close() watcher.Close()
@ -198,7 +200,7 @@ func slash(str string) string{
str = "/" + str str = "/" + str
} }
if string(str[len(str)-1]) == "/" { if string(str[len(str)-1]) == "/" {
if(string(str) == "/"){ if string(str) == "/" {
str = "" str = ""
} else { } else {
str = str[0 : len(str)-2] str = str[0 : len(str)-2]