Autocorrecting environment naming
baurmatt opened this issue · comments
Matthias Baur commented
r10k has this super useful feature to auto correcting environment names.
This is especially helpful if the branches naming follows the bug tracker (e.g. Jira/Youtrack/...) as they tend to be something like [A-Za-z]+-[0-9]+
Could this feature be please added to g10k? :)
Matthias Baur commented
Thanks @xorpaul! :)
Andreas Paul commented
Your welcome! :)
Please note that the default value is to leave the environment unchanged, which differs from the r10k default! So you would have to set the g10k config setting invalid_branches
to one of the following values:
correct_and_warn
: Non-word characters will be replaced with underscores and a warning will be emitted.correct
: Non-word characters will silently be replaced with underscores.error
: Branches with non-word characters will be ignored and an error will be emitted.
Like in r10k
Example:
---
:cachedir: '/tmp/g10k'
sources:
example:
remote: 'https://github.com/xorpaul/g10k-environment.git'
basedir: '/tmp/example/'
invalid_branches: 'correct'