refactor: package name should NOT be abbreviated
This commit is contained in:
parent
09534473bb
commit
ca9ec15e70
285
realize.go
285
realize.go
@ -3,14 +3,15 @@ package main
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/fatih/color"
|
|
||||||
i "github.com/tockins/interact"
|
|
||||||
s "github.com/tockins/realize/server"
|
|
||||||
c "github.com/tockins/realize/settings"
|
|
||||||
w "github.com/tockins/realize/watcher"
|
|
||||||
"gopkg.in/urfave/cli.v2"
|
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/fatih/color"
|
||||||
|
"github.com/tockins/interact"
|
||||||
|
"github.com/tockins/realize/server"
|
||||||
|
"github.com/tockins/realize/settings"
|
||||||
|
"github.com/tockins/realize/watcher"
|
||||||
|
cli "gopkg.in/urfave/cli.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -30,12 +31,12 @@ var r realize
|
|||||||
|
|
||||||
// Realize struct contains the general app informations
|
// Realize struct contains the general app informations
|
||||||
type realize struct {
|
type realize struct {
|
||||||
c.Settings `yaml:"settings,omitempty"`
|
settings.Settings `yaml:"settings,omitempty"`
|
||||||
Name, Description, Author, Email, Host, Version string `yaml:"-"`
|
Name, Description, Author, Email, Host, Version string `yaml:"-"`
|
||||||
Sync chan string `yaml:"-"`
|
Sync chan string `yaml:"-"`
|
||||||
Blueprint w.Blueprint `yaml:"-"`
|
Blueprint watcher.Blueprint `yaml:"-"`
|
||||||
Server s.Server `yaml:"-"`
|
Server server.Server `yaml:"-"`
|
||||||
Projects *[]w.Project `yaml:"projects" json:"projects"`
|
Projects *[]watcher.Project `yaml:"projects" json:"projects"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Realize struct initialization
|
// Realize struct initialization
|
||||||
@ -45,17 +46,17 @@ func init() {
|
|||||||
Version: version,
|
Version: version,
|
||||||
Description: description,
|
Description: description,
|
||||||
Sync: make(chan string),
|
Sync: make(chan string),
|
||||||
Settings: c.Settings{
|
Settings: settings.Settings{
|
||||||
Config: c.Config{
|
Config: settings.Config{
|
||||||
Create: true,
|
Create: true,
|
||||||
},
|
},
|
||||||
Resources: c.Resources{
|
Resources: settings.Resources{
|
||||||
Config: config,
|
Config: config,
|
||||||
Outputs: outputs,
|
Outputs: outputs,
|
||||||
Logs: logs,
|
Logs: logs,
|
||||||
Errors: errs,
|
Errors: errs,
|
||||||
},
|
},
|
||||||
Server: c.Server{
|
Server: settings.Server{
|
||||||
Status: false,
|
Status: false,
|
||||||
Open: false,
|
Open: false,
|
||||||
Host: host,
|
Host: host,
|
||||||
@ -63,11 +64,11 @@ func init() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
r.Blueprint = w.Blueprint{
|
r.Blueprint = watcher.Blueprint{
|
||||||
Settings: &r.Settings,
|
Settings: &r.Settings,
|
||||||
Sync: r.Sync,
|
Sync: r.Sync,
|
||||||
}
|
}
|
||||||
r.Server = s.Server{
|
r.Server = server.Server{
|
||||||
Blueprint: &r.Blueprint,
|
Blueprint: &r.Blueprint,
|
||||||
Settings: &r.Settings,
|
Settings: &r.Settings,
|
||||||
Sync: r.Sync,
|
Sync: r.Sync,
|
||||||
@ -135,7 +136,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
Action: func(p *cli.Context) error {
|
Action: func(p *cli.Context) error {
|
||||||
if p.Bool("legacy") {
|
if p.Bool("legacy") {
|
||||||
r.Config.Legacy = c.Legacy{
|
r.Config.Legacy = settings.Legacy{
|
||||||
Status: p.Bool("legacy"),
|
Status: p.Bool("legacy"),
|
||||||
Interval: interval,
|
Interval: interval,
|
||||||
}
|
}
|
||||||
@ -144,7 +145,7 @@ func main() {
|
|||||||
if p.Bool("no-config") {
|
if p.Bool("no-config") {
|
||||||
r.Config.Create = false
|
r.Config.Create = false
|
||||||
}
|
}
|
||||||
r.Blueprint.Projects = []w.Project{}
|
r.Blueprint.Projects = []watcher.Project{}
|
||||||
handle(r.Blueprint.Add(p))
|
handle(r.Blueprint.Add(p))
|
||||||
}
|
}
|
||||||
handle(r.Server.Start(p))
|
handle(r.Server.Start(p))
|
||||||
@ -190,41 +191,41 @@ func main() {
|
|||||||
Aliases: []string{"a"},
|
Aliases: []string{"a"},
|
||||||
Usage: "Define a new config file with all options step by step",
|
Usage: "Define a new config file with all options step by step",
|
||||||
Action: func(p *cli.Context) (err error) {
|
Action: func(p *cli.Context) (err error) {
|
||||||
i.Run(&i.Interact{
|
interact.Run(&interact.Interact{
|
||||||
Before: func(context i.Context) error {
|
Before: func(context interact.Context) error {
|
||||||
context.SetErr(r.Red.Bold("INVALID INPUT"))
|
context.SetErr(r.Red.Bold("INVALID INPUT"))
|
||||||
context.SetPrfx(color.Output, r.Yellow.Bold("[")+"REALIZE"+r.Yellow.Bold("]"))
|
context.SetPrfx(color.Output, r.Yellow.Bold("[")+"REALIZE"+r.Yellow.Bold("]"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Questions: []*i.Question{
|
Questions: []*interact.Question{
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
if _, err := os.Stat(".realize/" + config); err != nil {
|
if _, err := os.Stat(".realize/" + config); err != nil {
|
||||||
d.Skip()
|
d.Skip()
|
||||||
}
|
}
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Would you want to overwrite the existing " + r.Colors.Magenta.Bold("Realize") + " config?",
|
Msg: "Would you want to overwrite the existing " + r.Colors.Magenta.Bold("Realize") + " config?",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
} else if val {
|
} else if val {
|
||||||
r.Settings = c.Settings{
|
r.Settings = settings.Settings{
|
||||||
Config: c.Config{
|
Config: settings.Config{
|
||||||
Create: true,
|
Create: true,
|
||||||
},
|
},
|
||||||
Resources: c.Resources{
|
Resources: settings.Resources{
|
||||||
Config: config,
|
Config: config,
|
||||||
Outputs: outputs,
|
Outputs: outputs,
|
||||||
Logs: logs,
|
Logs: logs,
|
||||||
Errors: errs,
|
Errors: errs,
|
||||||
},
|
},
|
||||||
Server: c.Server{
|
Server: settings.Server{
|
||||||
Status: false,
|
Status: false,
|
||||||
Open: false,
|
Open: false,
|
||||||
Host: host,
|
Host: host,
|
||||||
@ -237,29 +238,29 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Would you want to customize the " + r.Colors.Magenta.Bold("settings") + "?",
|
Msg: "Would you want to customize the " + r.Colors.Magenta.Bold("settings") + "?",
|
||||||
Resolve: func(d i.Context) bool {
|
Resolve: func(d interact.Context) bool {
|
||||||
val, _ := d.Ans().Bool()
|
val, _ := d.Ans().Bool()
|
||||||
return val
|
return val
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Subs: []*i.Question{
|
Subs: []*interact.Question{
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(0, r.Green.Regular("(os default)"))
|
d.SetDef(0, r.Green.Regular("(os default)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[int]"),
|
Options: r.Yellow.Regular("[int]"),
|
||||||
Msg: "Max number of open files (root required)",
|
Msg: "Max number of open files (root required)",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Int()
|
val, err := d.Ans().Int()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -269,29 +270,29 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable legacy watch by polling",
|
Msg: "Enable legacy watch by polling",
|
||||||
Resolve: func(d i.Context) bool {
|
Resolve: func(d interact.Context) bool {
|
||||||
val, _ := d.Ans().Bool()
|
val, _ := d.Ans().Bool()
|
||||||
return val
|
return val
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Subs: []*i.Question{
|
Subs: []*interact.Question{
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(1, r.Green.Regular("(1s)"))
|
d.SetDef(1, r.Green.Regular("(1s)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[seconds]"),
|
Options: r.Yellow.Regular("[seconds]"),
|
||||||
Msg: "Set polling interval in seconds",
|
Msg: "Set polling interval in seconds",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Int()
|
val, err := d.Ans().Int()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -301,7 +302,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -311,29 +312,29 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable web server",
|
Msg: "Enable web server",
|
||||||
Resolve: func(d i.Context) bool {
|
Resolve: func(d interact.Context) bool {
|
||||||
val, _ := d.Ans().Bool()
|
val, _ := d.Ans().Bool()
|
||||||
return val
|
return val
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Subs: []*i.Question{
|
Subs: []*interact.Question{
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(5001, r.Green.Regular("(5001)"))
|
d.SetDef(5001, r.Green.Regular("(5001)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[int]"),
|
Options: r.Yellow.Regular("[int]"),
|
||||||
Msg: "Server port",
|
Msg: "Server port",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Int()
|
val, err := d.Ans().Int()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -343,15 +344,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef("localhost", r.Green.Regular("(localhost)"))
|
d.SetDef("localhost", r.Green.Regular("(localhost)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[string]"),
|
Options: r.Yellow.Regular("[string]"),
|
||||||
Msg: "Server host",
|
Msg: "Server host",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().String()
|
val, err := d.Ans().String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -361,15 +362,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Open in the current browser",
|
Msg: "Open in the current browser",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -379,7 +380,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -389,7 +390,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
_, err := d.Ans().Bool()
|
_, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -398,15 +399,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(true, r.Green.Regular("(y)"))
|
d.SetDef(true, r.Green.Regular("(y)"))
|
||||||
d.SetEnd("!")
|
d.SetEnd("!")
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Would you want to " + r.Colors.Magenta.Regular("add a new project") + "? (insert '!' to stop)",
|
Msg: "Would you want to " + r.Colors.Magenta.Regular("add a new project") + "? (insert '!' to stop)",
|
||||||
Resolve: func(d i.Context) bool {
|
Resolve: func(d interact.Context) bool {
|
||||||
val, _ := d.Ans().Bool()
|
val, _ := d.Ans().Bool()
|
||||||
if val {
|
if val {
|
||||||
r.Blueprint.Add(p)
|
r.Blueprint.Add(p)
|
||||||
@ -414,17 +415,17 @@ func main() {
|
|||||||
return val
|
return val
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Subs: []*i.Question{
|
Subs: []*interact.Question{
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(r.Settings.Wdir(), r.Green.Regular("("+r.Settings.Wdir()+")"))
|
d.SetDef(r.Settings.Wdir(), r.Green.Regular("("+r.Settings.Wdir()+")"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[string]"),
|
Options: r.Yellow.Regular("[string]"),
|
||||||
Msg: "Project name",
|
Msg: "Project name",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().String()
|
val, err := d.Ans().String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -434,16 +435,16 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
dir, _ := os.Getwd()
|
dir, _ := os.Getwd()
|
||||||
d.SetDef(dir, r.Green.Regular("("+dir+")"))
|
d.SetDef(dir, r.Green.Regular("("+dir+")"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[string]"),
|
Options: r.Yellow.Regular("[string]"),
|
||||||
Msg: "Project path",
|
Msg: "Project path",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().String()
|
val, err := d.Ans().String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -453,15 +454,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(true, r.Green.Regular("(y)"))
|
d.SetDef(true, r.Green.Regular("(y)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable go fmt",
|
Msg: "Enable go fmt",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -471,15 +472,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable go test",
|
Msg: "Enable go test",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -489,15 +490,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable go generate",
|
Msg: "Enable go generate",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -507,15 +508,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(true, r.Green.Regular("(y)"))
|
d.SetDef(true, r.Green.Regular("(y)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable go install",
|
Msg: "Enable go install",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -525,15 +526,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable go build",
|
Msg: "Enable go build",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -543,15 +544,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(true, r.Green.Regular("(y)"))
|
d.SetDef(true, r.Green.Regular("(y)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable go run",
|
Msg: "Enable go run",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -561,14 +562,14 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Customize the watched paths",
|
Msg: "Customize the watched paths",
|
||||||
Resolve: func(d i.Context) bool {
|
Resolve: func(d interact.Context) bool {
|
||||||
val, _ := d.Ans().Bool()
|
val, _ := d.Ans().Bool()
|
||||||
if val {
|
if val {
|
||||||
r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Paths = r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Paths[:len(r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Paths)-1]
|
r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Paths = r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Paths[:len(r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Paths)-1]
|
||||||
@ -576,17 +577,17 @@ func main() {
|
|||||||
return val
|
return val
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Subs: []*i.Question{
|
Subs: []*interact.Question{
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetEnd("!")
|
d.SetEnd("!")
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[string]"),
|
Options: r.Yellow.Regular("[string]"),
|
||||||
Msg: "Insert a path to watch (insert '!' to stop)",
|
Msg: "Insert a path to watch (insert '!' to stop)",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().String()
|
val, err := d.Ans().String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -597,7 +598,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
_, err := d.Ans().Bool()
|
_, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -606,14 +607,14 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Customize the ignored paths",
|
Msg: "Customize the ignored paths",
|
||||||
Resolve: func(d i.Context) bool {
|
Resolve: func(d interact.Context) bool {
|
||||||
val, _ := d.Ans().Bool()
|
val, _ := d.Ans().Bool()
|
||||||
if val {
|
if val {
|
||||||
r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Ignore = r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Ignore[:len(r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Ignore)-1]
|
r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Ignore = r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Ignore[:len(r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Ignore)-1]
|
||||||
@ -621,17 +622,17 @@ func main() {
|
|||||||
return val
|
return val
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Subs: []*i.Question{
|
Subs: []*interact.Question{
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetEnd("!")
|
d.SetEnd("!")
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[string]"),
|
Options: r.Yellow.Regular("[string]"),
|
||||||
Msg: "Insert a path to ignore (insert '!' to stop)",
|
Msg: "Insert a path to ignore (insert '!' to stop)",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().String()
|
val, err := d.Ans().String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -642,7 +643,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
_, err := d.Ans().Bool()
|
_, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -651,29 +652,29 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Add additionals arguments",
|
Msg: "Add additionals arguments",
|
||||||
Resolve: func(d i.Context) bool {
|
Resolve: func(d interact.Context) bool {
|
||||||
val, _ := d.Ans().Bool()
|
val, _ := d.Ans().Bool()
|
||||||
return val
|
return val
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Subs: []*i.Question{
|
Subs: []*interact.Question{
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetEnd("!")
|
d.SetEnd("!")
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[string]"),
|
Options: r.Yellow.Regular("[string]"),
|
||||||
Msg: "Insert an argument (insert '!' to stop)",
|
Msg: "Insert an argument (insert '!' to stop)",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().String()
|
val, err := d.Ans().String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -684,7 +685,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
_, err := d.Ans().Bool()
|
_, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -693,40 +694,40 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Add 'before' custom commands",
|
Msg: "Add 'before' custom commands",
|
||||||
Resolve: func(d i.Context) bool {
|
Resolve: func(d interact.Context) bool {
|
||||||
val, _ := d.Ans().Bool()
|
val, _ := d.Ans().Bool()
|
||||||
return val
|
return val
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Subs: []*i.Question{
|
Subs: []*interact.Question{
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetEnd("!")
|
d.SetEnd("!")
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[string]"),
|
Options: r.Yellow.Regular("[string]"),
|
||||||
Msg: "Insert a command (insert '!' to stop)",
|
Msg: "Insert a command (insert '!' to stop)",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().String()
|
val, err := d.Ans().String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
}
|
}
|
||||||
r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Scripts = append(r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Scripts, w.Command{Type: "before", Command: val})
|
r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Scripts = append(r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Scripts, watcher.Command{Type: "before", Command: val})
|
||||||
d.Reload()
|
d.Reload()
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
_, err := d.Ans().Bool()
|
_, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -735,40 +736,40 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Add 'after' custom commands",
|
Msg: "Add 'after' custom commands",
|
||||||
Resolve: func(d i.Context) bool {
|
Resolve: func(d interact.Context) bool {
|
||||||
val, _ := d.Ans().Bool()
|
val, _ := d.Ans().Bool()
|
||||||
return val
|
return val
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Subs: []*i.Question{
|
Subs: []*interact.Question{
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetEnd("!")
|
d.SetEnd("!")
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[string]"),
|
Options: r.Yellow.Regular("[string]"),
|
||||||
Msg: "Insert a command (insert '!' to stop)",
|
Msg: "Insert a command (insert '!' to stop)",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().String()
|
val, err := d.Ans().String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
}
|
}
|
||||||
r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Scripts = append(r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Scripts, w.Command{Type: "after", Command: val})
|
r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Scripts = append(r.Blueprint.Projects[len(r.Blueprint.Projects)-1].Watcher.Scripts, watcher.Command{Type: "after", Command: val})
|
||||||
d.Reload()
|
d.Reload()
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
_, err := d.Ans().Bool()
|
_, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -777,15 +778,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable watcher files preview",
|
Msg: "Enable watcher files preview",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -795,15 +796,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable file output history",
|
Msg: "Enable file output history",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -813,15 +814,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable file logs history",
|
Msg: "Enable file logs history",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -831,15 +832,15 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Before: func(d i.Context) error {
|
Before: func(d interact.Context) error {
|
||||||
d.SetDef(false, r.Green.Regular("(n)"))
|
d.SetDef(false, r.Green.Regular("(n)"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Quest: i.Quest{
|
Quest: interact.Quest{
|
||||||
Options: r.Yellow.Regular("[y/n]"),
|
Options: r.Yellow.Regular("[y/n]"),
|
||||||
Msg: "Enable file errors history",
|
Msg: "Enable file errors history",
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
val, err := d.Ans().Bool()
|
val, err := d.Ans().Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
@ -849,7 +850,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(d i.Context) interface{} {
|
Action: func(d interact.Context) interface{} {
|
||||||
if val, err := d.Ans().Bool(); err != nil {
|
if val, err := d.Ans().Bool(); err != nil {
|
||||||
return d.Err()
|
return d.Err()
|
||||||
} else if val {
|
} else if val {
|
||||||
@ -859,7 +860,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
After: func(d i.Context) error {
|
After: func(d interact.Context) error {
|
||||||
if val, _ := d.Qns().Get(0).Ans().Bool(); val {
|
if val, _ := d.Qns().Get(0).Ans().Bool(); val {
|
||||||
err = r.Settings.Remove()
|
err = r.Settings.Remove()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2,20 +2,21 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/labstack/echo"
|
|
||||||
"github.com/labstack/echo/middleware"
|
|
||||||
c "github.com/tockins/realize/settings"
|
|
||||||
w "github.com/tockins/realize/watcher"
|
|
||||||
"golang.org/x/net/websocket"
|
|
||||||
"gopkg.in/urfave/cli.v2"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/labstack/echo"
|
||||||
|
"github.com/labstack/echo/middleware"
|
||||||
|
"github.com/tockins/realize/settings"
|
||||||
|
"github.com/tockins/realize/watcher"
|
||||||
|
"golang.org/x/net/websocket"
|
||||||
|
"gopkg.in/urfave/cli.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server settings
|
// Server settings
|
||||||
type Server struct {
|
type Server struct {
|
||||||
*c.Settings `yaml:"-"`
|
*settings.Settings `yaml:"-"`
|
||||||
*w.Blueprint `yaml:"-"`
|
*watcher.Blueprint `yaml:"-"`
|
||||||
Sync chan string `yaml:"-"`
|
Sync chan string `yaml:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package settings
|
package settings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gopkg.in/yaml.v2"
|
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
yaml "gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Settings defines a group of general settings
|
// Settings defines a group of general settings
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package cli
|
package watcher
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gopkg.in/urfave/cli.v2"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
cli "gopkg.in/urfave/cli.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Run launches the toolchain for each project
|
// Run launches the toolchain for each project
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cli
|
package watcher
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package cli
|
package watcher
|
||||||
|
|
||||||
import (
|
import (
|
||||||
c "github.com/tockins/realize/settings"
|
|
||||||
"log"
|
"log"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/tockins/realize/settings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
@ -21,19 +22,19 @@ type pollWatcher struct {
|
|||||||
|
|
||||||
// Log struct
|
// Log struct
|
||||||
type logWriter struct {
|
type logWriter struct {
|
||||||
c.Colors
|
settings.Colors
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blueprint struct contains a projects list
|
// Blueprint struct contains a projects list
|
||||||
type Blueprint struct {
|
type Blueprint struct {
|
||||||
*c.Settings `yaml:"-"`
|
*settings.Settings `yaml:"-"`
|
||||||
Projects []Project `yaml:"projects,omitempty" json:"projects,omitempty"`
|
Projects []Project `yaml:"projects,omitempty" json:"projects,omitempty"`
|
||||||
Sync chan string `yaml:"-"`
|
Sync chan string `yaml:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Project defines the informations of a single project
|
// Project defines the informations of a single project
|
||||||
type Project struct {
|
type Project struct {
|
||||||
c.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"`
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package cli
|
package watcher
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gopkg.in/urfave/cli.v2"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
cli "gopkg.in/urfave/cli.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Argsparam parse one by one the given argumentes
|
// Argsparam parse one by one the given argumentes
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package cli
|
package watcher
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/fsnotify/fsnotify"
|
|
||||||
"log"
|
"log"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
@ -14,6 +13,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/fsnotify/fsnotify"
|
||||||
)
|
)
|
||||||
|
|
||||||
var msg string
|
var msg string
|
||||||
|
Loading…
Reference in New Issue
Block a user