From a6073963f9674c23571194b1b7ba9ff0706ce92d Mon Sep 17 00:00:00 2001 From: "Vojtech Vitek (V-Teq)" Date: Tue, 15 Dec 2015 14:22:41 -0500 Subject: [PATCH] Fix run_once backward compatibility on v0.3 --- supfile.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/supfile.go b/supfile.go index 1cde8f5..d34d2f0 100644 --- a/supfile.go +++ b/supfile.go @@ -95,14 +95,19 @@ func NewSupfile(file string) (*Supfile, error) { return nil, errors.New("network.inventory is not supported in Supfile v" + conf.Version) } } + fallthrough case "0.3": - for _, cmd := range conf.Commands { + var warning string + for key, cmd := range conf.Commands { if cmd.RunOnce { - fmt.Fprintf(os.Stderr, "Warning: command.run_once was deprecated by command.once in Supfile v"+conf.Version+"\n") - cmd.Once = cmd.RunOnce - break + warning = "Warning: command.run_once was deprecated by command.once in Supfile v" + conf.Version + "\n" + cmd.Once = true + conf.Commands[key] = cmd } } + if warning != "" { + fmt.Fprintf(os.Stderr, warning) + } default: return nil, errors.New("unsupported version, please update sup by `go get -u github.com/pressly/sup`") }