forked from toolshed/abra
refactor(recipe): rename Recipe2 -> Recipe
This commit is contained in:
@ -211,7 +211,7 @@ var appCmdListCommand = cli.Command{
|
||||
Before: internal.SubCommandBefore,
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
r := recipe.Get2(app.Name)
|
||||
r := recipe.Get(app.Name)
|
||||
|
||||
if err := r.EnsureExists(); err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -230,7 +230,7 @@ func createSecrets(cl *dockerClient.Client, secretsConfig map[string]secret.Secr
|
||||
}
|
||||
|
||||
// ensureDomainFlag checks if the domain flag was used. if not, asks the user for it/
|
||||
func ensureDomainFlag(recipe recipePkg.Recipe2, server string) error {
|
||||
func ensureDomainFlag(recipe recipePkg.Recipe, server string) error {
|
||||
if internal.Domain == "" && !internal.NoInput {
|
||||
prompt := &survey.Input{
|
||||
Message: "Specify app domain",
|
||||
|
@ -67,7 +67,7 @@ var appPsCommand = cli.Command{
|
||||
|
||||
// showPSOutput renders ps output.
|
||||
func showPSOutput(app appPkg.App, cl *dockerClient.Client) {
|
||||
r := recipe.Get2(app.Name)
|
||||
r := recipe.Get(app.Name)
|
||||
composeFiles, err := r.GetComposeFiles(app.Env)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -57,7 +57,7 @@ keys configured on your account.
|
||||
BashComplete: autocomplete.RecipeNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
recipeName := c.Args().First()
|
||||
r := recipe.Get2(recipeName)
|
||||
r := recipe.Get(recipeName)
|
||||
|
||||
if recipeName != "" {
|
||||
internal.ValidateRecipe(c)
|
||||
|
@ -85,7 +85,7 @@ func SetBumpType(bumpType string) {
|
||||
}
|
||||
|
||||
// GetMainAppImage retrieves the main 'app' image name
|
||||
func GetMainAppImage(recipe recipe.Recipe2) (string, error) {
|
||||
func GetMainAppImage(recipe recipe.Recipe) (string, error) {
|
||||
var path string
|
||||
|
||||
config, err := recipe.GetComposeConfig(nil)
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// ValidateRecipe ensures the recipe arg is valid.
|
||||
func ValidateRecipe(c *cli.Context) recipe.Recipe2 {
|
||||
func ValidateRecipe(c *cli.Context) recipe.Recipe {
|
||||
recipeName := c.Args().First()
|
||||
|
||||
if recipeName == "" && !NoInput {
|
||||
@ -57,7 +57,7 @@ func ValidateRecipe(c *cli.Context) recipe.Recipe2 {
|
||||
ShowSubcommandHelpAndError(c, errors.New("no recipe name provided"))
|
||||
}
|
||||
|
||||
chosenRecipe := recipe.Get2(recipeName)
|
||||
chosenRecipe := recipe.Get(recipeName)
|
||||
err := chosenRecipe.EnsureExists()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -24,7 +24,7 @@ var recipeFetchCommand = cli.Command{
|
||||
BashComplete: autocomplete.RecipeNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
recipeName := c.Args().First()
|
||||
r := recipe.Get2(recipeName)
|
||||
r := recipe.Get(recipeName)
|
||||
if recipeName != "" {
|
||||
internal.ValidateRecipe(c)
|
||||
if err := r.Ensure(false, false); err != nil {
|
||||
@ -40,7 +40,7 @@ var recipeFetchCommand = cli.Command{
|
||||
|
||||
catlBar := formatter.CreateProgressbar(len(catalogue), "fetching latest recipes...")
|
||||
for recipeName := range catalogue {
|
||||
r := recipe.Get2(recipeName)
|
||||
r := recipe.Get(recipeName)
|
||||
if err := r.Ensure(false, false); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ recipe and domain in the sample environment config).
|
||||
`,
|
||||
Action: func(c *cli.Context) error {
|
||||
recipeName := c.Args().First()
|
||||
r := recipe.Get2(recipeName)
|
||||
r := recipe.Get(recipeName)
|
||||
|
||||
if recipeName == "" {
|
||||
internal.ShowSubcommandHelpAndError(c, errors.New("no recipe name provided"))
|
||||
|
@ -141,7 +141,7 @@ your SSH keys configured on your account.
|
||||
}
|
||||
|
||||
// getImageVersions retrieves image versions for a recipe
|
||||
func getImageVersions(recipe recipe.Recipe2) (map[string]string, error) {
|
||||
func getImageVersions(recipe recipe.Recipe) (map[string]string, error) {
|
||||
services := make(map[string]string)
|
||||
|
||||
config, err := recipe.GetComposeConfig(nil)
|
||||
@ -185,7 +185,7 @@ func getImageVersions(recipe recipe.Recipe2) (map[string]string, error) {
|
||||
}
|
||||
|
||||
// createReleaseFromTag creates a new release based on a supplied recipe version string
|
||||
func createReleaseFromTag(recipe recipe.Recipe2, tagString, mainAppVersion string) error {
|
||||
func createReleaseFromTag(recipe recipe.Recipe, tagString, mainAppVersion string) error {
|
||||
var err error
|
||||
|
||||
directory := path.Join(config.RECIPES_DIR, recipe.Name)
|
||||
@ -249,7 +249,7 @@ func getTagCreateOptions(tag string) (git.CreateTagOptions, error) {
|
||||
|
||||
// addReleaseNotes checks if the release/next release note exists and moves the
|
||||
// file to release/<tag>.
|
||||
func addReleaseNotes(recipe recipe.Recipe2, tag string) error {
|
||||
func addReleaseNotes(recipe recipe.Recipe, tag string) error {
|
||||
repoPath := path.Join(config.RECIPES_DIR, recipe.Name)
|
||||
tagReleaseNotePath := path.Join(repoPath, "release", tag)
|
||||
if _, err := os.Stat(tagReleaseNotePath); err == nil {
|
||||
@ -323,7 +323,7 @@ func addReleaseNotes(recipe recipe.Recipe2, tag string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func commitRelease(recipe recipe.Recipe2, tag string) error {
|
||||
func commitRelease(recipe recipe.Recipe, tag string) error {
|
||||
if internal.Dry {
|
||||
log.Debugf("dry run: no changes committed")
|
||||
return nil
|
||||
@ -376,7 +376,7 @@ func tagRelease(tagString string, repo *git.Repository) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func pushRelease(recipe recipe.Recipe2, tagString string) error {
|
||||
func pushRelease(recipe recipe.Recipe, tagString string) error {
|
||||
if internal.Dry {
|
||||
log.Info("dry run: no changes published")
|
||||
return nil
|
||||
@ -405,7 +405,7 @@ func pushRelease(recipe recipe.Recipe2, tagString string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recipe.Recipe2, tags []string) error {
|
||||
func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recipe.Recipe, tags []string) error {
|
||||
directory := path.Join(config.RECIPES_DIR, recipe.Name)
|
||||
repo, err := git.PlainOpen(directory)
|
||||
if err != nil {
|
||||
@ -528,7 +528,7 @@ func cleanUpTag(tag, recipeName string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func getLabelVersion(recipe recipe.Recipe2, prompt bool) (string, error) {
|
||||
func getLabelVersion(recipe recipe.Recipe, prompt bool) (string, error) {
|
||||
initTag, err := recipe.GetVersionLabelLocal()
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -318,7 +318,7 @@ func getAvailableUpgrades(cl *dockerclient.Client, stackName string, recipeName
|
||||
|
||||
// processRecipeRepoVersion clones, pulls, checks out the version and lints the
|
||||
// recipe repository.
|
||||
func processRecipeRepoVersion(r recipe.Recipe2, version string) error {
|
||||
func processRecipeRepoVersion(r recipe.Recipe, version string) error {
|
||||
if err := r.EnsureExists(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -355,7 +355,7 @@ func mergeAbraShEnv(recipeName string, env envfile.AppEnv) error {
|
||||
}
|
||||
|
||||
// createDeployConfig merges and enriches the compose config for the deployment.
|
||||
func createDeployConfig(r recipe.Recipe2, stackName string, env envfile.AppEnv) (*composetypes.Config, stack.Deploy, error) {
|
||||
func createDeployConfig(r recipe.Recipe, stackName string, env envfile.AppEnv) (*composetypes.Config, stack.Deploy, error) {
|
||||
env["STACK_NAME"] = stackName
|
||||
|
||||
deployOpts := stack.Deploy{
|
||||
@ -438,12 +438,12 @@ func upgrade(cl *dockerclient.Client, stackName, recipeName,
|
||||
|
||||
app := appPkg.App{
|
||||
Name: stackName,
|
||||
Recipe: recipe.Get2(recipeName),
|
||||
Recipe: recipe.Get(recipeName),
|
||||
Server: SERVER,
|
||||
Env: env,
|
||||
}
|
||||
|
||||
r := recipe.Get2(recipeName)
|
||||
r := recipe.Get(recipeName)
|
||||
|
||||
if err = processRecipeRepoVersion(r, upgradeVersion); err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user