Update generator to use WHAT variable

This commit is contained in:
Christoph Blecker 2017-09-25 12:36:24 -07:00
parent dcc58b928c
commit 3047fbcab2
No known key found for this signature in database
GPG Key ID: B34A59A9D39F838B
3 changed files with 9 additions and 8 deletions

View File

@ -10,7 +10,7 @@ build-image:
docker build -q -t $(IMAGE_NAME) -f generator/Dockerfile generator
generate: build-image
docker run --rm -e WG -e SIG -v $(shell pwd):/go/src/app/generated:Z $(IMAGE_NAME) app
docker run --rm -e WHAT -v $(shell pwd):/go/src/app/generated:Z $(IMAGE_NAME) app
verify:
@hack/verify.sh

View File

@ -30,15 +30,16 @@ To (re)build documentation for all the SIGs, run these commands:
make all
```
To build docs for one SIG, run these commands:
To build docs for one SIG, run one these commands:
```bash
make SIG=sig-apps gen-docs
make SIG=sig-testing gen-docs
make WG=resource-management gen-docs
make WHAT=sig-apps
make WHAT=cluster-lifecycle
make WHAT=wg-resource-management
make WHAT=container-identity
```
where the `SIG` or `WG` var refers to the directory being built.
where the `WHAT` var refers to the directory being built.
## Adding custom content to your README

View File

@ -200,14 +200,14 @@ func writeCustomContentBlock(f *os.File, content string) {
func createGroupReadme(groups []Group, prefix string) error {
// figure out if the user wants to generate one group
var selectedGroupName *string
if envVal, ok := os.LookupEnv(strings.ToUpper(prefix)); ok {
if envVal, ok := os.LookupEnv("WHAT"); ok {
selectedGroupName = &envVal
}
for _, group := range groups {
group.Dir = group.DirName(prefix)
// skip generation if the user specified only one group
if selectedGroupName != nil && *selectedGroupName != group.Dir {
if selectedGroupName != nil && strings.HasSuffix(group.Dir, *selectedGroupName) == false {
fmt.Printf("Skipping %s/README.md\n", group.Dir)
continue
}