no conf method removed

This commit is contained in:
alessio 2017-09-18 00:15:21 +02:00
parent 6dda3c76d1
commit d8396809e8
2 changed files with 5 additions and 26 deletions

View File

@ -68,21 +68,20 @@ func main() {
}, },
Action: func(p *cli.Context) error { Action: func(p *cli.Context) error {
polling(p, &r.Legacy) polling(p, &r.Legacy)
noconf(p, &r.Settings)
if err := insert(p, &r.Blueprint); err != nil { if err := insert(p, &r.Blueprint); err != nil {
return err return err
} }
if !p.Bool("no-config") {
if err := r.Record(r); err != nil {
return err
}
}
if err := r.Server.Start(p); err != nil { if err := r.Server.Start(p); err != nil {
return err return err
} }
if err := r.Blueprint.Run(p); err != nil { if err := r.Blueprint.Run(p); err != nil {
return err return err
} }
if r.Make {
if err := r.Record(r); err != nil {
return err
}
}
return nil return nil
}, },
Before: before, Before: before,
@ -145,7 +144,6 @@ func main() {
return d.Err() return d.Err()
} else if val { } else if val {
r.Settings = settings.Settings{ r.Settings = settings.Settings{
Make: true,
File: settings.File, File: settings.File,
Server: settings.Server{ Server: settings.Server{
Status: false, Status: false,
@ -1110,7 +1108,6 @@ func before(*cli.Context) error {
r = realize{ r = realize{
Sync: make(chan string), Sync: make(chan string),
Settings: settings.Settings{ Settings: settings.Settings{
Make: true,
File: settings.File, File: settings.File,
Server: settings.Server{ Server: settings.Server{
Status: false, Status: false,
@ -1148,13 +1145,6 @@ func polling(c *cli.Context, s *settings.Legacy) {
} }
} }
// Check for the noconf option
func noconf(c *cli.Context, s *settings.Settings) {
if c.Bool("no-config") {
s.Make = false
}
}
// Insert a project if there isn't already one // Insert a project if there isn't already one
func insert(c *cli.Context, b *watcher.Blueprint) error { func insert(c *cli.Context, b *watcher.Blueprint) error {
if len(b.Projects) <= 0 { if len(b.Projects) <= 0 {

View File

@ -29,17 +29,6 @@ func TestBefore(t *testing.T) {
} }
} }
func TestNoConf(t *testing.T) {
settings := settings.Settings{Make: true}
set := flag.NewFlagSet("test", 0)
set.Bool("no-config", true, "")
params := cli.NewContext(nil, set, nil)
noconf(params, &settings)
if settings.Make == true {
t.Fatal("Expected", false, "Instead", true)
}
}
func TestPolling(t *testing.T) { func TestPolling(t *testing.T) {
settings := settings.Legacy{} settings := settings.Legacy{}
set := flag.NewFlagSet("test", 0) set := flag.NewFlagSet("test", 0)