forked from toolshed/abra
refactor: rename to RecipeMeta
This commit is contained in:
@ -51,8 +51,8 @@ type serviceMeta struct {
|
||||
Tag string `json:"tag"`
|
||||
}
|
||||
|
||||
// Recipe represents a recipe in the abra catalogue
|
||||
type Recipe struct {
|
||||
// RecipeMeta represents metadata for a recipe in the abra catalogue.
|
||||
type RecipeMeta struct {
|
||||
Category string `json:"category"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Description string `json:"description"`
|
||||
@ -65,7 +65,7 @@ type Recipe struct {
|
||||
}
|
||||
|
||||
// LatestVersion returns the latest version of a recipe.
|
||||
func (r Recipe) LatestVersion() string {
|
||||
func (r RecipeMeta) LatestVersion() string {
|
||||
var latestVersion string
|
||||
for tag := range r.Versions {
|
||||
// apps.json versions are sorted so the last key is latest
|
||||
@ -78,11 +78,11 @@ func (r Recipe) LatestVersion() string {
|
||||
type Name = string
|
||||
|
||||
// RecipeCatalogue represents the entire recipe catalogue.
|
||||
type RecipeCatalogue map[Name]Recipe
|
||||
type RecipeCatalogue map[Name]RecipeMeta
|
||||
|
||||
// Flatten converts AppCatalogue to slice
|
||||
func (r RecipeCatalogue) Flatten() []Recipe {
|
||||
recipes := make([]Recipe, 0, len(r))
|
||||
func (r RecipeCatalogue) Flatten() []RecipeMeta {
|
||||
recipes := make([]RecipeMeta, 0, len(r))
|
||||
for name := range r {
|
||||
recipes = append(recipes, r[name])
|
||||
}
|
||||
@ -90,7 +90,7 @@ func (r RecipeCatalogue) Flatten() []Recipe {
|
||||
}
|
||||
|
||||
// ByRecipeName sorts recipes by name.
|
||||
type ByRecipeName []Recipe
|
||||
type ByRecipeName []RecipeMeta
|
||||
|
||||
func (r ByRecipeName) Len() int { return len(r) }
|
||||
func (r ByRecipeName) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
|
||||
|
Reference in New Issue
Block a user