forked from toolshed/abra
refactor(recipe): add offline and chaos options to Ensure method
This commit is contained in:
@ -275,15 +275,23 @@ type Recipe2 struct {
|
||||
}
|
||||
|
||||
// Ensure makes sure the recipe exists, is up to date and has the latest version checked out.
|
||||
func (r Recipe2) Ensure() error {
|
||||
func (r Recipe2) Ensure(chaos bool, offline bool) error {
|
||||
if err := r.EnsureExists(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := r.EnsureUpToDate(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := r.EnsureLatest(); err != nil {
|
||||
return err
|
||||
|
||||
if !chaos {
|
||||
if err := r.EnsureIsClean(); err != nil {
|
||||
return err
|
||||
}
|
||||
if !offline {
|
||||
if err := r.EnsureUpToDate(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
if err := r.EnsureLatest(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user