build fix
This commit is contained in:
parent
117c3a0726
commit
982999e3af
|
@ -13,9 +13,6 @@ const(
|
|||
app_description = "Run and build your applications on file changes."
|
||||
app_author = "Alessio Pracchia"
|
||||
app_file = "realize.config.yaml"
|
||||
watcher_ext = ".go"
|
||||
watcher_path = "/"
|
||||
watcher_ignore = "vendor"
|
||||
)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
@ -25,6 +22,10 @@ var red = color.New(color.FgRed).SprintFunc()
|
|||
var blue = color.New(color.FgBlue, color.Bold).SprintFunc()
|
||||
var bluel = color.New(color.FgBlue).SprintFunc()
|
||||
|
||||
var watcher_ignores = []string {"vendor","bin"}
|
||||
var watcher_exts = []string {".go"}
|
||||
var watcher_paths = []string {"/"}
|
||||
|
||||
type App struct{
|
||||
Name,Version,Description,Author,Email string
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@ func New(params *cli.Context) *Config{
|
|||
Build: params.Bool("build"),
|
||||
Bin: params.Bool("bin"),
|
||||
Watcher: Watcher{
|
||||
Paths: []string{watcher_path},
|
||||
Ignore: []string{watcher_ignore},
|
||||
Exts: []string{watcher_ext},
|
||||
Paths: watcher_paths,
|
||||
Ignore: watcher_ignores,
|
||||
Exts: watcher_exts,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -107,9 +107,9 @@ func (h *Config) Add(params *cli.Context) error{
|
|||
Run: params.Bool("run"),
|
||||
Build: params.Bool("build"),
|
||||
Watcher: Watcher{
|
||||
Paths: []string{watcher_path},
|
||||
Exts: []string{watcher_ext},
|
||||
Ignore: []string{watcher_ignore},
|
||||
Paths: watcher_paths,
|
||||
Exts: watcher_exts,
|
||||
Ignore: watcher_ignores,
|
||||
},
|
||||
}
|
||||
if Duplicates(new, h.Projects) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"os/exec"
|
||||
"os"
|
||||
"bytes"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Project struct {
|
||||
|
@ -25,10 +26,19 @@ func GoRun () error{
|
|||
func (p *Project) GoBuild() error{
|
||||
var out bytes.Buffer
|
||||
base, _ := os.Getwd()
|
||||
build := exec.Command("go", "build", base + p.Path + p.Main)
|
||||
//build.Dir = base + p.Path
|
||||
path := base + p.Path
|
||||
|
||||
// create bin dir
|
||||
if _, err := os.Stat(path + "bin"); err != nil {
|
||||
if err = os.Mkdir(path + "bin", 0777); err != nil{
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
build := exec.Command("go", "build", path + p.Main)
|
||||
build.Dir = path + "bin"
|
||||
build.Stdout = &out
|
||||
if err := build.Run(); err != nil {
|
||||
fmt.Println(err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue