Skip to content

Commit

Permalink
generate Terraform Registry compatible docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mingfang committed Aug 12, 2020
1 parent febd4de commit 8bbeb67
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cmd/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func main() {
}

func generateSite() {
var baseDir = "./site"
var baseDir = "./docs/resources"
CreateDirIfNotExist(baseDir)

resourcesMap := k8s.BuildResourcesMap()
Expand All @@ -56,13 +56,10 @@ func generateSite() {
resource := resourcesMap[resourceKey]
schema := k8s.K8SConfig_Singleton().TFSchemasMap[resourceKey]

dir := baseDir + "/" + resourceKey
if k8s.IsDeprecated(schema) {
os.Remove(dir)
dir = baseDir + "/DEPRECATED/" + resourceKey
continue
}
CreateDirIfNotExist(dir)
file, err := os.OpenFile(dir+"/"+"README.md", os.O_WRONLY|os.O_CREATE, 0755)
file, err := os.OpenFile(baseDir + "/" + resourceKey[4:] + ".md", os.O_WRONLY|os.O_CREATE, 0755)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 8bbeb67

Please sign in to comment.