Skip to content

Commit

Permalink
Fix run_once backward compatibility on v0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
VojtechVitek committed Dec 15, 2015
1 parent d406a20 commit a607396
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions supfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`")
}
Expand Down

0 comments on commit a607396

Please sign in to comment.