Merge pull request #5467 from kobergj/FixDocsDeprecations

[docs-only] Fix Envvar Deprecation
This commit is contained in:
kobergj authored and GitHub committed 2023-01-27 11:44:25 +01:00
commit b49a79da74
3 files changed
+34 -13

No files matched your search

+31 -13
View File
@@ -52,18 +52,26 @@ type templateData struct {
func main() { func main() {
fmt.Println("Generating adoc documentation for environment variables:") fmt.Println("Generating adoc documentation for environment variables:")
content, err := os.ReadFile("../../docs/templates/ADOC.tmpl") adoc, err := os.ReadFile("../../docs/templates/ADOC.tmpl")
if err != nil {
log.Fatal(err)
}
dpr, err := os.ReadFile("../../docs/templates/ADOC_deprecation.tmpl")
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
replacer := strings.NewReplacer( replacer := strings.NewReplacer(
"github.com/owncloud/ocis/v2/services/", "", "github.com/owncloud/ocis/v2/services/", "",
"/pkg/config/defaults", "", "/pkg/config/defaults", "",
) )
var fields []ConfigField var (
var deprecations []DeprecationField fields []ConfigField
var targetFile *os.File deprecations []DeprecationField
tpl := template.Must(template.New("").Parse(string(content))) adocFile *os.File
dprFile *os.File
)
adoctpl := template.Must(template.New("").Parse(string(adoc)))
dprtpl := template.Must(template.New("").Parse(string(dpr)))
m := map[string]interface{}{ m := map[string]interface{}{
{{- range $key, $value := .}} {{- range $key, $value := .}}
@@ -103,19 +111,29 @@ func main() {
if len(fields) > 0 || len(deprecations) > 0 { if len(fields) > 0 || len(deprecations) > 0 {
fmt.Printf("... %s\n", pkg) fmt.Printf("... %s\n", pkg)
targetFile, err = os.Create(filepath.Join(targetFolder, service + "_configvars.adoc"))
if err != nil {
log.Fatalf("Failed to create target file: %s", err)
}
defer targetFile.Close()
td := templateData{ td := templateData{
ExtensionName: service, ExtensionName: service,
Fields: fields, Fields: fields,
Deprecations: deprecations, Deprecations: deprecations,
HasDeprecations: hasDeprecations , HasDeprecations: hasDeprecations ,
} }
if err := tpl.Execute(targetFile, td); err != nil { adocFile, err = os.Create(filepath.Join(targetFolder, service + "_configvars.adoc"))
if err != nil {
log.Fatalf("Failed to create target file: %s", err)
}
defer adocFile.Close()
if err := adoctpl.Execute(adocFile, td); err != nil {
log.Fatalf("Failed to execute template: %s", err)
}
dprFile, err = os.Create(filepath.Join(targetFolder, service + "_deprecation.adoc"))
if err != nil {
log.Fatalf("Failed to create target file: %s", err)
}
defer dprFile.Close()
if err := dprtpl.Execute(dprFile, td); err != nil {
log.Fatalf("Failed to execute template: %s", err) log.Fatalf("Failed to execute template: %s", err)
} }
} }
+1
View File
@@ -6,6 +6,7 @@ ifeval::[{show-deprecation} == true]
[[deprecation-note]] [[deprecation-note]]
[caption=] [caption=]
.Deprecation notes for the {{ .ExtensionName }} service
[width="100%",cols="~,~,~,~",options="header"] [width="100%",cols="~,~,~,~",options="header"]
|=== |===
| Deprecation Info | Deprecation Info
+2
View File
@@ -0,0 +1,2 @@
:show-deprecation: {{ .HasDeprecations }}