This commit is contained in:
alessio 2017-08-07 23:01:02 +02:00
parent 3dc0560aea
commit fea0250aa0
2 changed files with 18 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"github.com/tockins/realize/style" "github.com/tockins/realize/style"
cli "gopkg.in/urfave/cli.v2" cli "gopkg.in/urfave/cli.v2"
"os"
"strings" "strings"
) )
@ -51,6 +52,14 @@ func (h *Blueprint) Run(p *cli.Context) error {
h.Projects[k].tools = tools h.Projects[k].tools = tools
h.Projects[k].parent = h h.Projects[k].parent = h
h.Projects[k].path = h.Projects[k].Path h.Projects[k].path = h.Projects[k].Path
// env variables
for key, item := range h.Projects[k].Environment {
if err := os.Setenv(key, item); err != nil{
h.Projects[k].Buffer.StdErr = append(h.Projects[k].Buffer.StdErr, err)
}
}
if h.Legacy.Status { if h.Legacy.Status {
go h.Projects[k].watchByPolling() go h.Projects[k].watchByPolling()
} else { } else {

View File

@ -34,14 +34,15 @@ type Project struct {
settings.Settings `yaml:"-"` settings.Settings `yaml:"-"`
LastChangedOn time.Time `yaml:"-" json:"-"` LastChangedOn time.Time `yaml:"-" json:"-"`
base string base string
Name string `yaml:"name" json:"name"` Name string `yaml:"name" json:"name"`
Path string `yaml:"path" json:"path"` Path string `yaml:"path" json:"path"`
Cmds Cmds `yaml:"commands" json:"commands"` Environment map[string]string `yaml:"environment" json:"environment"`
Args []string `yaml:"args,omitempty" json:"args,omitempty"` Cmds Cmds `yaml:"commands" json:"commands"`
Watcher Watcher `yaml:"watcher" json:"watcher"` Args []string `yaml:"args,omitempty" json:"args,omitempty"`
Streams Streams `yaml:"streams,omitempty" json:"streams,omitempty"` Watcher Watcher `yaml:"watcher" json:"watcher"`
Buffer Buffer `yaml:"-" json:"buffer"` Streams Streams `yaml:"streams,omitempty" json:"streams,omitempty"`
ErrorOutputPattern string `yaml:"errorOutputPattern,omitempty" json:"errorOutputPattern,omitempty"` Buffer Buffer `yaml:"-" json:"buffer"`
ErrorOutputPattern string `yaml:"errorOutputPattern,omitempty" json:"errorOutputPattern,omitempty"`
parent *Blueprint parent *Blueprint
path string path string
tools tools tools tools