diff --git a/pkg/recipe/recipe.go b/pkg/recipe/recipe.go index 154f0cba..61be4dc7 100644 --- a/pkg/recipe/recipe.go +++ b/pkg/recipe/recipe.go @@ -2,6 +2,7 @@ package recipe import ( "fmt" + "os" "path" "path/filepath" "strings" @@ -95,13 +96,18 @@ func Get(recipeName string) (Recipe, error) { return Recipe{Name: recipeName, Config: config}, nil } -// EnsureExists checks whether a recipe has been cloned locally or not. +// EnsureExists ensures that a recipe is locally cloned func EnsureExists(recipe string) error { recipeDir := path.Join(config.ABRA_DIR, "apps", strings.ToLower(recipe)) - url := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, recipe) - if err := gitPkg.Clone(recipeDir, url); err != nil { - return err + + if _, err := os.Stat(recipeDir); os.IsNotExist(err) { + logrus.Debugf("%s does not exist, attemmpting to clone", recipeDir) + url := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, recipe) + if err := gitPkg.Clone(recipeDir, url); err != nil { + return err + } } + return nil }