refactor: apps -> recipes

This commit is contained in:
2021-12-25 14:04:07 +01:00
parent 3b5354b2a5
commit 4283f130a2
21 changed files with 72 additions and 67 deletions

View File

@ -29,7 +29,7 @@ var recipeLintCommand = &cli.Command{
}
envSampleProvided := false
envSample := fmt.Sprintf("%s/%s/.env.sample", config.APPS_DIR, recipe.Name)
envSample := fmt.Sprintf("%s/%s/.env.sample", config.RECIPES_DIR, recipe.Name)
if _, err := os.Stat(envSample); !os.IsNotExist(err) {
envSampleProvided = true
} else if err != nil {

View File

@ -39,7 +39,7 @@ The new example repository is cloned to ~/.abra/apps/<recipe>.
internal.ShowSubcommandHelpAndError(c, errors.New("no recipe provided"))
}
directory := path.Join(config.APPS_DIR, recipeName)
directory := path.Join(config.RECIPES_DIR, recipeName)
if _, err := os.Stat(directory); !os.IsNotExist(err) {
logrus.Fatalf("%s recipe directory already exists?", directory)
}
@ -49,16 +49,16 @@ The new example repository is cloned to ~/.abra/apps/<recipe>.
logrus.Fatal(err)
}
gitRepo := path.Join(config.APPS_DIR, recipeName, ".git")
gitRepo := path.Join(config.RECIPES_DIR, recipeName, ".git")
if err := os.RemoveAll(gitRepo); err != nil {
logrus.Fatal(err)
}
logrus.Debugf("removed git repo in %s", gitRepo)
toParse := []string{
path.Join(config.APPS_DIR, recipeName, "README.md"),
path.Join(config.APPS_DIR, recipeName, ".env.sample"),
path.Join(config.APPS_DIR, recipeName, ".drone.yml"),
path.Join(config.RECIPES_DIR, recipeName, "README.md"),
path.Join(config.RECIPES_DIR, recipeName, ".env.sample"),
path.Join(config.RECIPES_DIR, recipeName, ".drone.yml"),
}
for _, path := range toParse {
file, err := os.OpenFile(path, os.O_RDWR, 0664)
@ -82,14 +82,14 @@ The new example repository is cloned to ~/.abra/apps/<recipe>.
}
}
newGitRepo := path.Join(config.APPS_DIR, recipeName)
newGitRepo := path.Join(config.RECIPES_DIR, recipeName)
if err := git.Init(newGitRepo, true); err != nil {
logrus.Fatal(err)
}
logrus.Infof(
"new recipe %s created in %s, happy hacking!\n",
recipeName, path.Join(config.APPS_DIR, recipeName),
recipeName, path.Join(config.RECIPES_DIR, recipeName),
)
return nil

View File

@ -177,7 +177,7 @@ func getImageVersions(recipe recipe.Recipe) (map[string]string, error) {
func createReleaseFromTag(recipe recipe.Recipe, tagString, mainAppVersion string) error {
var err error
directory := path.Join(config.APPS_DIR, recipe.Name)
directory := path.Join(config.RECIPES_DIR, recipe.Name)
repo, err := git.PlainOpen(directory)
if err != nil {
return err
@ -269,7 +269,7 @@ func commitRelease(recipe recipe.Recipe) error {
}
if internal.Commit {
repoPath := path.Join(config.APPS_DIR, recipe.Name)
repoPath := path.Join(config.RECIPES_DIR, recipe.Name)
if err := gitPkg.Commit(repoPath, "compose.**yml", internal.CommitMessage, internal.Dry); err != nil {
return err
}
@ -343,7 +343,7 @@ func pushRelease(tagString string, repo *git.Repository) error {
}
func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recipe.Recipe, tags []string) error {
directory := path.Join(config.APPS_DIR, recipe.Name)
directory := path.Join(config.RECIPES_DIR, recipe.Name)
repo, err := git.PlainOpen(directory)
if err != nil {
return err
@ -421,7 +421,7 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip
// cleanUpTag removes a freshly created tag
func cleanUpTag(tag, recipeName string) error {
directory := path.Join(config.APPS_DIR, recipeName)
directory := path.Join(config.RECIPES_DIR, recipeName)
repo, err := git.PlainOpen(directory)
if err != nil {
return err

View File

@ -95,7 +95,7 @@ will know that things are likely to change.
}
if nextTag == "" {
recipeDir := path.Join(config.APPS_DIR, recipe.Name)
recipeDir := path.Join(config.RECIPES_DIR, recipe.Name)
repo, err := git.PlainOpen(recipeDir)
if err != nil {
logrus.Fatal(err)

View File

@ -61,7 +61,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
// check for versions file and load pinned versions
versionsPresent := false
recipeDir := path.Join(config.ABRA_DIR, "apps", recipe.Name)
recipeDir := path.Join(config.RECIPES_DIR, recipe.Name)
versionsPath := path.Join(recipeDir, "versions")
var servicePins = make(map[string]imgPin)
if _, err := os.Stat(versionsPath); err == nil {