forked from toolshed/abra
refactor: apps -> recipes
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user