Skip to content

Commit

Permalink
Update generator to use WHAT variable
Browse files Browse the repository at this point in the history
  • Loading branch information
cblecker committed Sep 25, 2017
1 parent dcc58b9 commit 3047fbc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions generator/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3047fbc

Please sign in to comment.