Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ test_output
**/generated-plugin

!.github/ISSUE_TEMPLATE/config.yml

evaluation_results
9 changes: 2 additions & 7 deletions cmd/generate-plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ func generateFileFromTemplate(data CatalogData, templatePath, OutputDir string)
}
return out
},
"snake_case": snakeCase,
"simplifiedName": simplifiedName,
"snake_case": snakeCase,
}).Parse(string(templateContent))
if err != nil {
return fmt.Errorf("error parsing template file %s: %w", templatePath, err)
Expand Down Expand Up @@ -240,7 +239,7 @@ func writeCatalogFile(catalog *layer2.Catalog) error {
return fmt.Errorf("error marshaling YAML: %w", err)
}

dirPath := filepath.Join(OutputDir, "data", simplifiedName(catalog.Metadata.Id, catalog.Metadata.Version))
dirPath := filepath.Join(OutputDir, "data", "catalogs")
filePath := filepath.Join(dirPath, "catalog.yaml")

err = os.MkdirAll(dirPath, os.ModePerm)
Expand All @@ -261,10 +260,6 @@ func snakeCase(in string) string {
strings.ReplaceAll(in, ".", "_"), "-", "_"))
}

func simplifiedName(catalogId string, catalogVersion string) string {
return fmt.Sprintf("%s_%s", snakeCase(catalogId), snakeCase(catalogVersion))
}

func copyNonTemplateFile(templatePath, relativePath string) error {
outputPath := filepath.Join(OutputDir, relativePath)
if err := os.MkdirAll(filepath.Dir(outputPath), os.ModePerm); err != nil {
Expand Down
Loading