forked from toolshed/abra
refactor(recipe): rename Recipe2 -> Recipe
This commit is contained in:
@ -16,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
// Ensure makes sure the recipe exists, is up to date and has the latest version checked out.
|
||||
func (r Recipe2) Ensure(chaos bool, offline bool) error {
|
||||
func (r Recipe) Ensure(chaos bool, offline bool) error {
|
||||
if err := r.EnsureExists(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -38,7 +38,7 @@ func (r Recipe2) Ensure(chaos bool, offline bool) error {
|
||||
}
|
||||
|
||||
// EnsureExists ensures that the recipe is locally cloned
|
||||
func (r Recipe2) EnsureExists() error {
|
||||
func (r Recipe) EnsureExists() error {
|
||||
recipeDir := path.Join(config.RECIPES_DIR, r.Name)
|
||||
|
||||
if _, err := os.Stat(recipeDir); os.IsNotExist(err) {
|
||||
@ -57,7 +57,7 @@ func (r Recipe2) EnsureExists() error {
|
||||
}
|
||||
|
||||
// EnsureVersion checks whether a specific version exists for a recipe.
|
||||
func (r Recipe2) EnsureVersion(version string) error {
|
||||
func (r Recipe) EnsureVersion(version string) error {
|
||||
recipeDir := path.Join(config.RECIPES_DIR, r.Name)
|
||||
|
||||
if err := gitPkg.EnsureGitRepo(recipeDir); err != nil {
|
||||
@ -115,7 +115,7 @@ func (r Recipe2) EnsureVersion(version string) error {
|
||||
}
|
||||
|
||||
// EnsureIsClean makes sure that the recipe repository has no unstaged changes.
|
||||
func (r Recipe2) EnsureIsClean() error {
|
||||
func (r Recipe) EnsureIsClean() error {
|
||||
recipeDir := path.Join(config.RECIPES_DIR, r.Name)
|
||||
|
||||
isClean, err := gitPkg.IsClean(recipeDir)
|
||||
@ -132,7 +132,7 @@ func (r Recipe2) EnsureIsClean() error {
|
||||
}
|
||||
|
||||
// EnsureLatest makes sure the latest commit is checked out for the local recipe repository
|
||||
func (r Recipe2) EnsureLatest() error {
|
||||
func (r Recipe) EnsureLatest() error {
|
||||
recipeDir := path.Join(config.RECIPES_DIR, r.Name)
|
||||
|
||||
if err := gitPkg.EnsureGitRepo(recipeDir); err != nil {
|
||||
@ -169,7 +169,7 @@ func (r Recipe2) EnsureLatest() error {
|
||||
}
|
||||
|
||||
// EnsureUpToDate ensures that the local repo is synced to the remote
|
||||
func (r Recipe2) EnsureUpToDate() error {
|
||||
func (r Recipe) EnsureUpToDate() error {
|
||||
recipeDir := path.Join(config.RECIPES_DIR, r.Name)
|
||||
|
||||
repo, err := git.PlainOpen(recipeDir)
|
||||
@ -222,7 +222,7 @@ func (r Recipe2) EnsureUpToDate() error {
|
||||
}
|
||||
|
||||
// ChaosVersion constructs a chaos mode recipe version.
|
||||
func (r Recipe2) ChaosVersion() (string, error) {
|
||||
func (r Recipe) ChaosVersion() (string, error) {
|
||||
var version string
|
||||
|
||||
head, err := gitPkg.GetRecipeHead(r.Name)
|
||||
@ -247,7 +247,7 @@ func (r Recipe2) ChaosVersion() (string, error) {
|
||||
|
||||
// Push pushes the latest changes to a SSH URL remote. You need to have your
|
||||
// local SSH configuration for git.coopcloud.tech working for this to work
|
||||
func (r Recipe2) Push(dryRun bool) error {
|
||||
func (r Recipe) Push(dryRun bool) error {
|
||||
repo, err := git.PlainOpen(r.Dir)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -265,7 +265,7 @@ func (r Recipe2) Push(dryRun bool) error {
|
||||
}
|
||||
|
||||
// Tags list the recipe tags
|
||||
func (r Recipe2) Tags() ([]string, error) {
|
||||
func (r Recipe) Tags() ([]string, error) {
|
||||
var tags []string
|
||||
|
||||
repo, err := git.PlainOpen(r.Dir)
|
||||
@ -291,7 +291,7 @@ func (r Recipe2) Tags() ([]string, error) {
|
||||
}
|
||||
|
||||
// GetRecipeVersions retrieves all recipe versions.
|
||||
func (r Recipe2) GetRecipeVersions(offline bool) (RecipeVersions, error) {
|
||||
func (r Recipe) GetRecipeVersions(offline bool) (RecipeVersions, error) {
|
||||
versions := RecipeVersions{}
|
||||
log.Debugf("attempting to open git repository in %s", r.Dir)
|
||||
|
||||
|
Reference in New Issue
Block a user