Skip to content

Commit

Permalink
Version template for package docs (#4568) (#4794)
Browse files Browse the repository at this point in the history
Co-authored-by: Juan Álvarez <[email protected]>
  • Loading branch information
axw and jalvz authored Feb 18, 2021
1 parent 263be12 commit 75f4b51
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
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
File renamed without changes.
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

0 comments on commit 75f4b51

Please sign in to comment.