Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version template for package docs #4568

Merged
merged 5 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
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: 1 addition & 1 deletion apmpackage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#### Update / fix a package

1. Actual work
- Make changes in `apmpackage/apm/<version>`, `apmpackage/docs/README.template.md` and/or code as needed
- Make changes in `apmpackage/apm/<version>` and/or code as needed
- Run `make update`. That will update fields, pipeline and doc files based on apm-server fields and pipeline defs.

2. Run the registry
Expand Down
4 changes: 2 additions & 2 deletions apmpackage/cmd/gen-package/gendocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ func generateDocs(inputFields map[string][]field, version string) {
MetricsExample: loadExample("metricsets.json"),
ErrorExample: loadExample("errors.json"),
}
t := template.New(docsTemplateFilePath)
t := template.New(docsTemplateFilePath(version))
tmpl, err := t.Funcs(map[string]interface{}{
"Trim": strings.TrimSpace,
}).ParseFiles(docsTemplateFilePath)
}).ParseFiles(docsTemplateFilePath(version))
if err != nil {
panic(err)
}
Expand Down
4 changes: 3 additions & 1 deletion apmpackage/cmd/gen-package/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ package main

import "path/filepath"

var docsTemplateFilePath = "apmpackage/docs/README.template.md"
func docsTemplateFilePath(version string) string {
return filepath.Join("apmpackage/apm/", version, "/_dev/docs/README.template.md")
}

func docsFilePath(version string) string {
return filepath.Join("apmpackage/apm/", version, "/docs/README.md")
Expand Down