Skip to content
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
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,12 @@ kit/module-kit.sh ../WittyPhotos

GNU Affero General Public License v3.0 (or later): see [LICENSE](LICENSE) and [NOTICE](NOTICE). If you redistribute it or build on it, please keep the NOTICE attribution.

## Legal

WittyModule is an independent open-source project. It isn't associated with, sponsored by or
endorsed by any publisher, rights holder, service or other media software project. A module built
with it comes from whoever published that module. Any third-party names here only describe what it
works with, and belong to their owners. It's provided “as is”, with no warranty; see
[LICENSE](LICENSE). Local law applies to how you use it. This isn't legal advice.

<!-- module-kit -->
## Releasing

WittyModule reaches a server inside the projects built with it, so a release has no files of its own: a version tag runs the tests and publishes a release that those projects can require.

Versions move in small steps as work lands. `go run github.com/wittywilla/wittymodule/cmd/wittymodule@v0.4.0 bump .` raises it
Versions move in small steps as work lands. `go run github.com/wittywilla/wittymodule/cmd/wittymodule@v0.5.5 bump .` raises it
everywhere it is written (add `-part minor` for a bigger step). A bump isn't a release: nothing is
tagged or published until you tag it. CI fails when code changed since the last tag and the version
didn't, because tags never move.
Expand All @@ -143,3 +135,11 @@ To release:

Licensed under AGPL-3.0-or-later: see [LICENSE](LICENSE) and [NOTICE](NOTICE).
<!-- /module-kit -->

## Legal

WittyModule is an independent open-source project. It isn't associated with, sponsored by or
endorsed by any publisher, rights holder, service or other media software project. A module built
with it comes from whoever published that module. Any third-party names here only describe what it
works with, and belong to their owners. It's provided “as is”, with no warranty; see
[LICENSE](LICENSE). Local law applies to how you use it. This isn't legal advice.
15 changes: 13 additions & 2 deletions kit/module-kit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ render() { # <template> <output>
-e "s|@@README_WITHDRAW@@|$readme_withdraw|" -e "s|@@LICENSE@@|$license|g" > "$2"
}

# Puts the generated section at the end of the README, or in place of the one there.
# Puts the generated section just before the README's Legal section, which every README ends
# with, or at the end when it has none. A section an older kit wrote after Legal moves there too.
readme() { # <folder>
local file="$1/README.md" section kept
section=$(mktemp)
Expand All @@ -61,7 +62,17 @@ readme() { # <folder>
# Without the section and the blank line before it, the file is what its owner wrote.
awk '/<!-- module-kit -->/ { skip = 1 } !skip { print } /<!-- \/module-kit -->/ { skip = 0 }' "$file" |
sed -e ':a' -e '/^[[:space:]]*$/{$d;N;ba' -e '}' > "$kept"
{ cat "$kept"; echo; cat "$section"; } > "$file"
if grep -q '^## Legal[[:space:]]*$' "$kept"; then
awk -v section="$section" '
!done && /^## Legal[[:space:]]*$/ {
while ((getline line < section) > 0) print line
print ""
done = 1
}
{ print }' "$kept" > "$file"
else
{ cat "$kept"; echo; cat "$section"; } > "$file"
fi
rm -f "$section" "$kept"
}

Expand Down
Loading