summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Hannaford <jamie.hannaford@rackspace.com>2017-05-04 17:49:12 +0200
committerJamie Hannaford <jamie.hannaford@rackspace.com>2017-05-16 12:26:37 +0200
commit676d8264c66844c78abf48263ccc3e4283e3b5da (patch)
treee38d2190fba2b3aa6c89952c8c24d84e6dd612ee
parentad450f5ed3bb58d97f4fe4d43cc60e746134bd41 (diff)
Reformat directory structure
-rw-r--r--Makefile2
-rw-r--r--build/app.go182
-rw-r--r--build/footer.mustache1
-rw-r--r--build/sig_index.mustache27
-rw-r--r--build/sig_list.mustache27
-rw-r--r--generator/Dockerfile (renamed from build/Dockerfile)0
-rw-r--r--generator/README.md (renamed from build/README.md)3
-rw-r--r--generator/app.go193
-rw-r--r--generator/footer.tmpl3
-rw-r--r--generator/header.tmpl10
-rw-r--r--generator/sig_index.tmpl27
-rw-r--r--generator/sig_list.tmpl22
-rw-r--r--sig-contributor-experience/README.md (renamed from sig-contribx/README.md)0
-rw-r--r--sig-on-premise/README.md (renamed from sig-on-prem/README.md)0
-rw-r--r--sig-product-management/README.md (renamed from sig-pm/README.md)0
-rw-r--r--sig-product-management/SIG PM representatives.md (renamed from sig-pm/SIG PM representatives.md)0
-rw-r--r--sigs.yaml5
17 files changed, 260 insertions, 242 deletions
diff --git a/Makefile b/Makefile
index 4b6df911..d0cc2941 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ reset-docs:
git checkout HEAD -- sig-list.md sig-*
build-sigdocs:
- docker build -t sigdocs -f build/Dockerfile build
+ docker build -t sigdocs -f generator/Dockerfile generator
run-sigdocs:
docker run -v $(shell pwd):/go/src/app sigdocs
diff --git a/build/app.go b/build/app.go
deleted file mode 100644
index b6b0e469..00000000
--- a/build/app.go
+++ /dev/null
@@ -1,182 +0,0 @@
-package main
-
-import (
- "fmt"
- "io/ioutil"
- "log"
- "os"
- "time"
-
- "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)
- footerTemplate = fmt.Sprintf("%s/footer.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
-}
-
-type Page struct {
- LastGenerated string
-}
-
-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 constructFooter() (data string, err error) {
- template, err := mustache.ParseFile(footerTemplate)
- if err != nil {
- return
- }
-
- ctx := Page{LastGenerated: time.Now().Format("Mon Jan 2 2006 15:04:05")}
-
- data, err = template.Render(ctx)
- if err != nil {
- return
- }
-
- err = ioutil.WriteFile(sigListOutput, []byte(data), 0644)
- if err != nil {
- return
- }
-
- return
-}
-
-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
- }
- }
-
- footer, err := constructFooter()
- if err != nil {
- return err
- }
-
- filePath := fmt.Sprintf("%s/%s", sig.Dir, sigIndexOutput)
- err = ioutil.WriteFile(filePath, []byte(data+footer), 0644)
- if err != nil {
- return err
- }
-
- fmt.Printf("Generated %s\n", filePath)
- }
-
- 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
- }
-
- footer, err := constructFooter()
- if err != nil {
- return err
- }
-
- err = ioutil.WriteFile(sigListOutput, []byte(data+footer), 0644)
- if err != nil {
- return err
- }
-
- fmt.Printf("Generated %s\n", sigListOutput)
- 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)
- }
-
- fmt.Println("Finished generation!")
-}
diff --git a/build/footer.mustache b/build/footer.mustache
deleted file mode 100644
index 5b4c6462..00000000
--- a/build/footer.mustache
+++ /dev/null
@@ -1 +0,0 @@
-Last generated: {{LastGenerated}}
diff --git a/build/sig_index.mustache b/build/sig_index.mustache
deleted file mode 100644
index 46177bf3..00000000
--- a/build/sig_index.mustache
+++ /dev/null
@@ -1,27 +0,0 @@
-<!---
-This is an autogenerated file!
-
-Please do not edit this file directly, but instead make changes to the
-sigs.yaml file in the project root.
-
-To understand how this file is generated, see build/README.md.
--->
-# {{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
deleted file mode 100644
index 9400cf59..00000000
--- a/build/sig_list.mustache
+++ /dev/null
@@ -1,27 +0,0 @@
-<!---
-This is an autogenerated file!
-
-Please do not edit this file directly, but instead make changes to the
-sigs.yaml file in the project root.
-
-To understand how this file is generated, see build/README.md.
--->
-# 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}}
diff --git a/build/Dockerfile b/generator/Dockerfile
index e07f42e4..e07f42e4 100644
--- a/build/Dockerfile
+++ b/generator/Dockerfile
diff --git a/build/README.md b/generator/README.md
index 97e075f6..f6feccea 100644
--- a/build/README.md
+++ b/generator/README.md
@@ -14,6 +14,5 @@ Based off the `sigs.yaml` metadata file.
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
+make all
```
diff --git a/generator/app.go b/generator/app.go
new file mode 100644
index 00000000..bca45db0
--- /dev/null
+++ b/generator/app.go
@@ -0,0 +1,193 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "log"
+ "os"
+ "path/filepath"
+ "sort"
+ "strings"
+ "text/template"
+ "time"
+
+ "gopkg.in/yaml.v2"
+)
+
+var (
+ sigsYamlFile = "sigs.yaml"
+ templateDir = "generator"
+ indexTemplate = filepath.Join(templateDir, "sig_index.tmpl")
+ listTemplate = filepath.Join(templateDir, "sig_list.tmpl")
+ headerTemplate = filepath.Join(templateDir, "header.tmpl")
+ footerTemplate = filepath.Join(templateDir, "footer.tmpl")
+ sigListOutput = "sig-list.md"
+ sigIndexOutput = "README.md"
+ githubTeamNames = []string{"misc", "test-failures", "bugs", "feature-requests", "proposals", "pr-reviews", "api-reviews"}
+)
+
+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"`
+ FullGitHubTeams bool `yaml:"full_github_teams"`
+ GithubTeamPrefix string `yaml:"github_team_prefix"`
+ GithubTeamNames []string
+}
+
+type Sig struct {
+ Page
+ 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 {
+ Page
+ Sigs []Sig
+}
+
+type Page struct {
+ LastGenerated string
+}
+
+func (slice SigEntries) Len() int {
+ return len(slice.Sigs)
+}
+
+func (slice SigEntries) Less(i, j int) bool {
+ return slice.Sigs[i].Name < slice.Sigs[j].Name
+}
+
+func (slice SigEntries) Swap(i, j int) {
+ slice.Sigs[i], slice.Sigs[j] = slice.Sigs[j], slice.Sigs[i]
+}
+
+func createDirIfNotExists(path string) error {
+ _, err := os.Stat(path)
+ if os.IsNotExist(err) {
+ fmt.Printf("%s directory does not exist, creating\n", path)
+ return os.Mkdir(path, 0755)
+ }
+ return nil
+}
+
+func writeTemplate(templatePath, outputPath string, data interface{}) error {
+ // set up template
+ t, err := template.ParseFiles(templatePath, headerTemplate, footerTemplate)
+ if err != nil {
+ return err
+ }
+
+ // open file and truncate
+ f, err := os.OpenFile(outputPath, os.O_WRONLY, 0644)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+ f.Truncate(0)
+
+ // write template output to file
+ err = t.Execute(f, data)
+ if err != nil {
+ return err
+ }
+
+ fmt.Printf("Generated %s\n", outputPath)
+ return nil
+}
+
+func lastGenerated() string {
+ return time.Now().Format("Mon Jan 2 2006 15:04:05")
+}
+
+func createReadmeFiles(ctx SigEntries) error {
+ for _, sig := range ctx.Sigs {
+ dirName := fmt.Sprintf("sig-%s", strings.ToLower(strings.Replace(sig.Name, " ", "-", -1)))
+
+ createDirIfNotExists(dirName)
+
+ sig.LastGenerated = lastGenerated()
+
+ prefix := sig.Contact.GithubTeamPrefix
+ if prefix == "" {
+ prefix = dirName
+ }
+
+ for _, gtn := range githubTeamNames {
+ sig.Contact.GithubTeamNames = append(sig.Contact.GithubTeamNames, fmt.Sprintf("%s-%s", prefix, gtn))
+ }
+
+ outputPath := fmt.Sprintf("%s/%s", dirName, sigIndexOutput)
+ if err := writeTemplate(indexTemplate, outputPath, sig); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+func createListFile(ctx SigEntries) error {
+ ctx.LastGenerated = lastGenerated()
+ return writeTemplate(listTemplate, sigListOutput, ctx)
+}
+
+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)
+ }
+
+ sort.Sort(ctx)
+
+ err = createReadmeFiles(ctx)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ err = createListFile(ctx)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ fmt.Println("Finished generation!")
+}
diff --git a/generator/footer.tmpl b/generator/footer.tmpl
new file mode 100644
index 00000000..58aef73c
--- /dev/null
+++ b/generator/footer.tmpl
@@ -0,0 +1,3 @@
+{{- define "footer" -}}
+Last generated: {{.LastGenerated}}
+{{- end -}}
diff --git a/generator/header.tmpl b/generator/header.tmpl
new file mode 100644
index 00000000..9f53887a
--- /dev/null
+++ b/generator/header.tmpl
@@ -0,0 +1,10 @@
+{{- define "header" -}}
+<!---
+This is an autogenerated file!
+
+Please do not edit this file directly, but instead make changes to the
+sigs.yaml file in the project root.
+
+To understand how this file is generated, see generator/README.md.
+-->
+{{- end -}}
diff --git a/generator/sig_index.tmpl b/generator/sig_index.tmpl
new file mode 100644
index 00000000..066d3391
--- /dev/null
+++ b/generator/sig_index.tmpl
@@ -0,0 +1,27 @@
+{{- template "header" }}
+# {{.Name}} SIG
+
+{{ .MissionStatement }}
+## Meetings
+{{- range .Meetings }}
+* [{{.Day}}s at {{.UTC}} UTC]({{$.MeetingURL}}) ({{.Frequency}}). [Convert to your timezone](http://www.thetimezoneconverter.com/?t={{.UTC}}&tz=UTC).
+{{- end }}
+
+Meeting notes and Agenda can be found [here]({{.MeetingArchiveURL}}).
+
+## Leads
+{{- range .Leads }}
+* [{{.Name}}](https://github.com/{{.GitHub}}){{if .Company}}, {{.Company}}{{end}}
+{{- end }}
+
+## Contact
+* [Slack](https://kubernetes.slack.com/messages/{{.Contact.Slack}})
+* [Mailing list]({{.Contact.MailingList}})
+{{if .Contact.FullGitHubTeams}}
+## GitHub Teams
+{{range .Contact.GithubTeamNames -}}
+* [@{{.}}](https://github.com/kubernetes/teams/{{.}})
+{{end}}
+{{end}}
+
+{{template "footer" . }}
diff --git a/generator/sig_list.tmpl b/generator/sig_list.tmpl
new file mode 100644
index 00000000..abb0b302
--- /dev/null
+++ b/generator/sig_list.tmpl
@@ -0,0 +1,22 @@
+{{- template "header" }}
+# 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 |
+|------|-------|---------|----------|
+{{- range .Sigs}}
+|[{{.Name}}]({{.Dir}}/README.md)|{{range .Leads}}* [{{.Name}}](https://github.com/{{.GitHub}}){{if .Company}}, {{.Company}}{{end}}<br>{{end}}|* [Slack](https://kubernetes.slack.com/messages/{{.Contact.Slack}})<br>* [Mailing List]({{.Contact.MailingList}})|{{ $save := . }}{{range .Meetings}}* [{{.Day}}s at {{.UTC}} UTC ({{.Frequency}})]({{$save.MeetingURL}})<br>{{end}}
+{{- end }}
+
+{{ template "footer" . }}
diff --git a/sig-contribx/README.md b/sig-contributor-experience/README.md
index f6f27acc..f6f27acc 100644
--- a/sig-contribx/README.md
+++ b/sig-contributor-experience/README.md
diff --git a/sig-on-prem/README.md b/sig-on-premise/README.md
index 84671c32..84671c32 100644
--- a/sig-on-prem/README.md
+++ b/sig-on-premise/README.md
diff --git a/sig-pm/README.md b/sig-product-management/README.md
index 4d27f577..4d27f577 100644
--- a/sig-pm/README.md
+++ b/sig-product-management/README.md
diff --git a/sig-pm/SIG PM representatives.md b/sig-product-management/SIG PM representatives.md
index ee4319a9..ee4319a9 100644
--- a/sig-pm/SIG PM representatives.md
+++ b/sig-product-management/SIG PM representatives.md
diff --git a/sigs.yaml b/sigs.yaml
index a12f7b92..b3af45af 100644
--- a/sigs.yaml
+++ b/sigs.yaml
@@ -22,7 +22,6 @@ sigs:
contact:
slack: sig-api-machinery
mailing_list: https://groups.google.com/forum/#!forum/kubernetes-sig-api-machinery
- github_team: sig-api-machinery-misc
- name: Apps
dir: sig-apps
mission_statement: >
@@ -71,7 +70,6 @@ sigs:
contact:
slack: sig-auth
mailing_list: https://groups.google.com/forum/#!forum/kubernetes-sig-auth
- github_team: sig-auth
- name: Autoscaling
dir: sig-autoscaling
mission_statement: >
@@ -360,6 +358,8 @@ sigs:
contact:
slack: sig-onprem
mailing_list: https://groups.google.com/forum/#!forum/kubernetes-sig-on-prem
+ full_github_teams: true
+ github_team_prefix: onprem
- name: OpenStack
dir: sig-openstack
mission_statement: >
@@ -384,6 +384,7 @@ sigs:
contact:
slack: sig-openstack
mailing_list: https://groups.google.com/forum/#!forum/kubernetes-sig-openstack
+ full_github_teams: true
- name: Product Management
dir: sig-pm
mission_statement: >