refactor(recipe): introduce new recipe struct and move some methods
This commit is contained in:
@ -52,28 +52,29 @@ recipes.
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
stackName := app.StackName()
|
||||
r2 := recipe.Get2(app.Recipe)
|
||||
|
||||
specificVersion := c.Args().Get(1)
|
||||
if specificVersion != "" && internal.Chaos {
|
||||
log.Fatal("cannot use <version> and --chaos together")
|
||||
}
|
||||
|
||||
if err := recipe.EnsureExists(app.Recipe); err != nil {
|
||||
if err := r2.EnsureExists(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if !internal.Chaos {
|
||||
if err := recipe.EnsureIsClean(app.Recipe); err != nil {
|
||||
if err := r2.EnsureIsClean(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if !internal.Offline {
|
||||
if err := recipe.EnsureUpToDate(app.Recipe); err != nil {
|
||||
if err := r2.EnsureUpToDate(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := recipe.EnsureLatest(app.Recipe); err != nil {
|
||||
if err := r2.EnsureLatest(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
@ -107,7 +108,7 @@ recipes.
|
||||
if specificVersion != "" {
|
||||
version = specificVersion
|
||||
log.Debugf("choosing %s as version to deploy", version)
|
||||
if err := recipe.EnsureVersion(app.Recipe, version); err != nil {
|
||||
if err := r2.EnsureVersion(version); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
@ -157,7 +158,7 @@ recipes.
|
||||
if len(versions) > 0 && !internal.Chaos {
|
||||
version = versions[len(versions)-1]
|
||||
log.Debugf("choosing %s as version to deploy", version)
|
||||
if err := recipe.EnsureVersion(app.Recipe, version); err != nil {
|
||||
if err := r2.EnsureVersion(version); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else {
|
||||
@ -173,7 +174,7 @@ recipes.
|
||||
if internal.Chaos {
|
||||
log.Warnf("chaos mode engaged")
|
||||
var err error
|
||||
version, err = recipe.ChaosVersion(app.Recipe)
|
||||
version, err = r2.ChaosVersion()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user