From 3b3453da465bff319c0a4dae132b2031966a37a1 Mon Sep 17 00:00:00 2001 From: alessio Date: Tue, 5 Sep 2017 19:39:52 +0200 Subject: [PATCH] bin flag to install --- realize.go | 4 ++-- settings/settings.go | 2 +- watcher/cmd.go | 6 +++--- watcher/exec.go | 2 +- watcher/main.go | 8 ++++---- watcher/watcher.go | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/realize.go b/realize.go index 6cff828..dacb134 100644 --- a/realize.go +++ b/realize.go @@ -572,7 +572,7 @@ func main() { return d.Err() } if val != "" { - r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Cmds.Bin.Args = append(r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Cmds.Bin.Args, val) + r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Cmds.Install.Args = append(r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Cmds.Install.Args, val) } return nil }, @@ -583,7 +583,7 @@ func main() { if err != nil { return d.Err() } - r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Cmds.Bin.Status = val + r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Cmds.Install.Status = val return nil }, }, diff --git a/settings/settings.go b/settings/settings.go index 1eb70e6..9f99536 100644 --- a/settings/settings.go +++ b/settings/settings.go @@ -22,7 +22,7 @@ const ( type Settings struct { File string `yaml:"-" json:"-"` Make bool `yaml:"-" json:"-"` - Files `yaml:"files" json:"files"` + Files `yaml:"files,omitempty" json:"files,omitempty"` Legacy `yaml:"legacy,omitempty" json:"legacy,omitempty"` Server `yaml:"server,omitempty" json:"server,omitempty"` FileLimit int64 `yaml:"flimit,omitempty" json:"flimit,omitempty"` diff --git a/watcher/cmd.go b/watcher/cmd.go index 703d64f..36efed4 100644 --- a/watcher/cmd.go +++ b/watcher/cmd.go @@ -113,8 +113,8 @@ func (h *Blueprint) Add(p *cli.Context) error { Build: Cmd{ Status: p.Bool("build"), }, - Bin: Cmd{ - Status: !p.Bool("no-bin"), + Install: Cmd{ + Status: !p.Bool("no-install"), }, Run: !p.Bool("no-run"), }, @@ -167,7 +167,7 @@ func (h *Blueprint) List() error { fmt.Fprintln(style.Output, name, style.Yellow.Regular("Fmt"), ":", style.Magenta.Regular(val.Cmds.Fmt)) fmt.Fprintln(style.Output, name, style.Yellow.Regular("Generate"), ":", style.Magenta.Regular(val.Cmds.Generate)) fmt.Fprintln(style.Output, name, style.Yellow.Regular("Test"), ":", style.Magenta.Regular(val.Cmds.Test)) - fmt.Fprintln(style.Output, name, style.Yellow.Regular("Install"), ":", style.Magenta.Regular(val.Cmds.Bin)) + fmt.Fprintln(style.Output, name, style.Yellow.Regular("Install"), ":", style.Magenta.Regular(val.Cmds.Install)) fmt.Fprintln(style.Output, name, style.Yellow.Regular("Build"), ":", style.Magenta.Regular(val.Cmds.Build)) fmt.Fprintln(style.Output, name, style.Yellow.Regular("Run"), ":", style.Magenta.Regular(val.Cmds.Run)) if len(val.Args) > 0 { diff --git a/watcher/exec.go b/watcher/exec.go index 5c350ea..85947b8 100644 --- a/watcher/exec.go +++ b/watcher/exec.go @@ -131,7 +131,7 @@ func (p *Project) goInstall() (string, error) { return "", err } args := []string{"install"} - for _, arg := range p.Cmds.Bin.Args { + for _, arg := range p.Cmds.Install.Args { arr := strings.Fields(arg) args = append(args, arr...) } diff --git a/watcher/main.go b/watcher/main.go index 2db3014..ed690d2 100644 --- a/watcher/main.go +++ b/watcher/main.go @@ -64,7 +64,7 @@ type Cmds struct { Fmt Cmd `yaml:"fmt,omitempty" json:"fmt,omitempty"` Test Cmd `yaml:"test,omitempty" json:"test,omitempty"` Generate Cmd `yaml:"generate,omitempty" json:"generate,omitempty"` - Bin Cmd `yaml:"bin" json:"bin"` + Install Cmd `yaml:"install" json:"install"` Build Cmd `yaml:"build,omitempty" json:"build,omitempty"` Run bool `yaml:"run,omitempty" json:"run,omitempty"` } @@ -77,10 +77,10 @@ type Cmd struct { // Watcher struct defines the livereload's logic type Watcher struct { - Preview bool `yaml:"preview,omitempty" json:"preview,omitempty"` Paths []string `yaml:"paths" json:"paths"` - Ignore []string `yaml:"ignore_paths,omitempty" json:"ignore_paths,omitempty"` - Exts []string `yaml:"exts" json:"exts"` + Exts []string `yaml:"extensions" json:"extensions"` + Ignore []string `yaml:"ignored_paths,omitempty" json:"ignored_paths,omitempty"` + Preview bool `yaml:"preview,omitempty" json:"preview,omitempty"` Scripts []Command `yaml:"scripts,omitempty" json:"scripts,omitempty"` } diff --git a/watcher/watcher.go b/watcher/watcher.go index dd471e3..12eb7ce 100644 --- a/watcher/watcher.go +++ b/watcher/watcher.go @@ -201,7 +201,7 @@ func (p *Project) watch(watcher watcher) error { // Install calls an implementation of "go install" func (p *Project) install() error { - if p.Cmds.Bin.Status { + if p.Cmds.Install.Status { start := time.Now() log.Println(p.pname(p.Name, 1), ":", "Installing..") stream, err := p.goInstall()