From 8a62b647296954d7195c8b705a8700a87b669769 Mon Sep 17 00:00:00 2001 From: alessio Date: Sat, 20 Aug 2016 12:55:21 +0200 Subject: [PATCH] main file field removed, no longer necessary --- README.md | 7 +++---- main.go | 2 -- realize/config.go | 5 +---- realize/project.go | 1 - realize/watcher.go | 5 ----- 5 files changed, 4 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index fbc3c3f..09128ec 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ![Logo](http://i.imgur.com/8nr2s1b.jpg) -A Golang build system with file watchers and live reload. Run, build and watch file changes with custom paths +A Golang build system with file watchers, output streams and live reload. Run, build and watch file changes with custom paths ![Preview](http://i.imgur.com/XljkxAA.png) @@ -38,7 +38,6 @@ A Golang build system with file watchers and live reload. Run, build and watch f ``` --name="Project Name" -> Name, if not specified sect "Sample App" - --main="test.go" -> Main file, if not specified sect "main.go" --base="server" -> Base Path, if not specified sect "/" --build="true" -> Go build, if not specified sect "false" --bin="false" -> Base Path, if not specified sect "true" @@ -46,7 +45,7 @@ A Golang build system with file watchers and live reload. Run, build and watch f ``` ``` - $ realize start --name="Web Server" --main="test.go" --base="server" + $ realize start --name="Web Server" --base="server" ``` - Add another project whenever you want @@ -57,7 +56,7 @@ A Golang build system with file watchers and live reload. Run, build and watch f Or ``` - $ realize add --name="Project Name" --main="main.go" --build="true" + $ realize add --name="Project Name" --build="true" ``` - Remove a project by his name diff --git a/main.go b/main.go index d92219c..6b9a1d6 100644 --- a/main.go +++ b/main.go @@ -52,7 +52,6 @@ func main() { Usage: "Create the initial config", Flags: []cli.Flag{ &cli.StringFlag{Name: "name", Aliases: []string{"n"}, Value: "Sample App", Usage: "Project name \t"}, - &cli.StringFlag{Name: "main", Aliases: []string{"m"}, Value: "main.go", Usage: "Project main file \t"}, &cli.StringFlag{Name: "base", Aliases: []string{"b"}, Value: "/", Usage: "Project base path \t"}, &cli.BoolFlag{Name: "build", Value: false}, &cli.BoolFlag{Name: "run", Value: true}, @@ -74,7 +73,6 @@ func main() { Usage: "Add another project", Flags: []cli.Flag{ &cli.StringFlag{Name: "name", Aliases: []string{"n"}, Value: "Sample App", Usage: "Project name \t"}, - &cli.StringFlag{Name: "main", Aliases: []string{"m"}, Value: "main.go", Usage: "Project main file \t"}, &cli.StringFlag{Name: "base", Aliases: []string{"b"}, Value: "/", Usage: "Project base path \t"}, &cli.BoolFlag{Name: "build", Value: false}, &cli.BoolFlag{Name: "run", Value: true}, diff --git a/realize/config.go b/realize/config.go index 10f0bb5..64ef1ac 100644 --- a/realize/config.go +++ b/realize/config.go @@ -24,7 +24,6 @@ func New(params *cli.Context) *Config { Projects: []Project{ { Name: params.String("name"), - Main: params.String("main"), Path: params.String("base"), Run: params.Bool("run"), Build: params.Bool("build"), @@ -42,7 +41,7 @@ func New(params *cli.Context) *Config { // Duplicates check projects with same name or same combinations of main/path func Duplicates(value Project, arr []Project) bool { for _, val := range arr { - if value.Main == val.Main && value.Path == val.Path || value.Name == val.Name { + if value.Path == val.Path || value.Name == val.Name { Fail("There is a duplicate of '"+val.Name+"'. Check your config file!") return true } @@ -106,7 +105,6 @@ func (h *Config) Add(params *cli.Context) error { if err == nil { new := Project{ Name: params.String("name"), - Main: params.String("main"), Path: params.String("base"), Run: params.Bool("run"), Build: params.Bool("build"), @@ -154,7 +152,6 @@ func (h *Config) List() error { if err == nil { for _, val := range h.Projects { fmt.Println(green("|"), green(val.Name)) - fmt.Println(greenl("|"), "\t", green("Main File:"), red(val.Main)) fmt.Println(greenl("|"), "\t", green("Base Path:"), red(val.Path)) fmt.Println(greenl("|"), "\t", green("Run:"), red(val.Run)) fmt.Println(greenl("|"), "\t", green("Build:"), red(val.Build)) diff --git a/realize/project.go b/realize/project.go index ca5b3a0..b1d654f 100644 --- a/realize/project.go +++ b/realize/project.go @@ -18,7 +18,6 @@ type Project struct { base string Name string `yaml:"app_name,omitempty"` Path string `yaml:"app_path,omitempty"` - Main string `yaml:"app_main,omitempty"` Run bool `yaml:"app_run,omitempty"` Bin bool `yaml:"app_bin,omitempty"` Build bool `yaml:"app_build,omitempty"` diff --git a/realize/watcher.go b/realize/watcher.go index 70cecd9..174eef8 100644 --- a/realize/watcher.go +++ b/realize/watcher.go @@ -78,16 +78,11 @@ func (p *Project) Watching() { } defer end() - p.Main = slash(p.Main) p.base = base + p.Path for _, dir := range p.Watcher.Paths { // check main existence dir = slash(dir) - if _, err := os.Stat(p.base + dir + p.Main); err != nil { - Fail(p.Name + ": \t" + p.base + dir + p.Main + " doesn't exist. Main is required") - return - } base = p.base + dir if _, err := os.Stat(base); err == nil {