gliderlabs / gliderlabs/pagebuilder

whitelist/blacklist branches for generated versions.json

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
16
Forks
4
PR merge metrics
No merged PRs in 30d

Description

I really like the dynamically generated `versions.json` over the manual maintenance of the **extra** section of mkdocs.yml.

But the issues are:
- whenever someone sends a pull-request, it will be included in the versions dropdown.
- if a branch name includes any of the words: "latest", "site", "build", it will be excluded from the versions list.

I would like to have more control over the directory inclusion/exclusion.

Although i could do the filtering in the client side with javascript, i would prefer to have a correctly generated `versions.json`.

The [sigil cal](https://github.com/gliderlabs/pagebuilder/blob/master/scripts/deploy#L58) uses the `dirs "*"` function call. But currently `dirs` doesn't supports patterns. I see 3 solutions:
- Use `dirs "*"` in a range, and use a wrapped match:
`{{ range dirs "." | drop "latest" | drop ".git" | drop "site" | drop "build" }} {{if match "$WHITELIST" . }} {{.}} {{end}} {{end}}`
- Add a sigil function which supports pattern matching like `dirspatt "v[0-9]* latest"`. but this seems like breaking the "do one thing" rule.
- Just use plain shell functionality to get the directory list and feed it into sigil via env variable:

```
: ${WHITELIST:="v[0-9]*"}
dirsToInclude=$(ls -d "$WHITELIST")
sigil -i '...template...' dirsToInclude=$dirsToInclude
```

Or maybe I'm just lost in the details, and there is much simpler obvious solution. Im happy to do a PR if you tell which direction makes sense.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.