summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Hannaford <jamie.hannaford@rackspace.com>2017-04-24 17:19:23 +0200
committerJamie Hannaford <jamie.hannaford@rackspace.com>2017-05-16 12:23:44 +0200
commitff667b86099ffcc9bd8bc67f8afad974b650af10 (patch)
treebfbe91a48826d5d4fae61aca47b5cb2d6ad1889b
parent2192dbd9308ef2f4abd4dcf7708dc860590fa19f (diff)
Add build tools to generate SIGME docs
-rw-r--r--build/Dockerfile1
-rw-r--r--build/README.md19
-rw-r--r--build/app.go139
-rw-r--r--build/sig_index.mustache19
-rw-r--r--build/sig_list.mustache19
5 files changed, 197 insertions, 0 deletions
diff --git a/build/Dockerfile b/build/Dockerfile
new file mode 100644
index 00000000..e07f42e4
--- /dev/null
+++ b/build/Dockerfile
@@ -0,0 +1 @@
+FROM golang:1.6-onbuild
diff --git a/build/README.md b/build/README.md
new file mode 100644
index 00000000..97e075f6
--- /dev/null
+++ b/build/README.md
@@ -0,0 +1,19 @@
+# SIG Doc builder
+
+This script will generate the following documentation files:
+
+```
+sig-*/README.md
+sig-list.md
+```
+
+Based off the `sigs.yaml` metadata file.
+
+## How to use
+
+To (re)build documentation for all the SIGs, run these commands:
+
+```bash
+docker build -t sigdocs -f build/Dockerfile build
+docker run -v $(pwd):/go/src/app sigdocs
+```
diff --git a/build/app.go b/build/app.go
new file mode 100644
index 00000000..43701fcd
--- /dev/null
+++ b/build/app.go
@@ -0,0 +1,139 @@
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "log"
+ "os"
+
+ "github.com/cbroglie/mustache"
+ "gopkg.in/yaml.v2"
+)
+
+var (
+ sigsYamlFile = "sigs.yaml"
+ templateDir = "build"
+ indexTemplate = fmt.Sprintf("%s/sig_index.mustache", templateDir)
+ listTemplate = fmt.Sprintf("%s/sig_list.mustache", templateDir)
+ sigListOutput = "sig-list.md"
+ sigIndexOutput = "README.md"
+)
+
+type Lead struct {
+ Name string
+ Company string
+ GitHub string
+}
+
+type Meeting struct {
+ Day string
+ UTC string
+ PST string
+ Frequency string
+}
+
+type Contact struct {
+ Slack string
+ MailingList string `yaml:"mailing_list"`
+ GitHubTeam string `yaml:"github_team"`
+}
+
+type Sig struct {
+ Name string
+ Dir string
+ MissionStatement string `yaml:"mission_statement"`
+ Leads []Lead
+ Meetings []Meeting
+ MeetingURL string `yaml:"meeting_url"`
+ MeetingArchiveURL string `yaml:"meeting_archive_url"`
+ Contact Contact
+}
+
+type SigEntries struct {
+ Sigs []Sig
+}
+
+func dirExists(path string) (bool, error) {
+ _, err := os.Stat(path)
+ if err == nil {
+ return true, nil
+ }
+ if os.IsNotExist(err) {
+ return false, nil
+ }
+ return true, err
+}
+
+func createReadmeFiles(ctx SigEntries) error {
+ template, err := mustache.ParseFile(indexTemplate)
+ if err != nil {
+ return err
+ }
+
+ for _, sig := range ctx.Sigs {
+ data, err := template.Render(sig)
+ if err != nil {
+ return err
+ }
+
+ exists, err := dirExists(sig.Dir)
+ if err != nil {
+ return err
+ }
+ if !exists {
+ err = os.Mkdir(sig.Dir, 0755)
+ if err != nil {
+ return err
+ }
+ }
+
+ err = ioutil.WriteFile(fmt.Sprintf("%s/%s", sig.Dir, sigIndexOutput), []byte(data), 0644)
+ if err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+func createListFile(ctx SigEntries) error {
+ template, err := mustache.ParseFile(listTemplate)
+ if err != nil {
+ return err
+ }
+
+ data, err := template.Render(ctx)
+ if err != nil {
+ return err
+ }
+
+ err = ioutil.WriteFile(sigListOutput, []byte(data), 0644)
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func main() {
+ yamlData, err := ioutil.ReadFile(sigsYamlFile)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ var ctx SigEntries
+ err = yaml.Unmarshal(yamlData, &ctx)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ err = createReadmeFiles(ctx)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ err = createListFile(ctx)
+ if err != nil {
+ log.Fatal(err)
+ }
+}
diff --git a/build/sig_index.mustache b/build/sig_index.mustache
new file mode 100644
index 00000000..d80f0719
--- /dev/null
+++ b/build/sig_index.mustache
@@ -0,0 +1,19 @@
+# {{Name}} SIG
+
+{{MissionStatement}}
+## Meetings
+{{#Meetings}}
+- [{{Day}}s at {{UTC}} UTC]({{MeetingURL}}) ({{Frequency}})
+{{/Meetings}}
+Meeting notes and Agenda can be found [here]({{MeetingArchiveURL}}).
+
+## Leads
+{{#Leads}}
+- [{{Name}}](https://github.com/{{GitHub}}){{#Company}}, {{Company}}{{/Company}}
+{{/Leads}}
+## Contact
+{{#Contact}}
+Slack: https://kubernetes.slack.com/messages/{{Slack}}
+Mailing list: {{MailingList}}
+{{#GitHubTeam}}GitHub Team: https://github.com/kubernetes/teams/{{GitHubTeam}}{{/GitHubTeam}}
+{{/Contact}}
diff --git a/build/sig_list.mustache b/build/sig_list.mustache
new file mode 100644
index 00000000..7637f192
--- /dev/null
+++ b/build/sig_list.mustache
@@ -0,0 +1,19 @@
+# SIGs and Working Groups
+
+Most community activity is organized into Special Interest Groups (SIGs),
+time bounded Working Groups, and the [community meeting](communication.md#Meeting).
+
+SIGs follow these [guidelines](governance.md) although each of these groups may operate a little differently
+depending on their needs and workflow.
+
+Each group's material is in its subdirectory in this project.
+
+When the need arises, a [new SIG can be created](sig-creation-procedure.md)
+
+### Master SIG List
+
+| Name | Leads | Contact | Meetings |
+|------|-------|---------|----------|
+{{#Sigs}}
+|[{{ Name }}]({{ Dir }}/README.md)|{{#Leads}}- [{{Name}}](https://github.com/{{GitHub}}){{#Company}}, {{Company}}{{/Company}}<br>{{/Leads}}|{{#Contact}}- [Slack](https://kubernetes.slack.com/messages/{{Slack}})<br>- [Mailing List]({{MailingList}}){{/Contact}}|{{#Meetings}}- [{{Day}}s at {{UTC}} UTC ({{Frequency}})]({{MeetingURL}})<br>{{/Meetings}}
+{{/Sigs}}