Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generator to use WHAT variable #1127

Merged
merged 1 commit into from
Sep 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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