diff options
Diffstat (limited to 'build/awk/init')
-rw-r--r-- | build/awk/init | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/build/awk/init b/build/awk/init index f416b34..edb0d1e 100644 --- a/build/awk/init +++ b/build/awk/init @@ -51,8 +51,8 @@ git init # necessary meta data prompt APPLICATION_NAME "The name of the application" "$(basename "$PWD")" -prompt APPLICATION_NAME_STYLIZED "The stylized name of the application (for documentation)" "$(echo "$APPLICATION_NAME" | sed 's/\([a-z]*\)/\u\1/')" -prompt APPLICATION_NAME_CAPITALIZED_MAN_PART "The capitalized name of the application (for documentation also with a man section part)" "$(echo "$APPLICATION_NAME" | sed 's/\([a-z]*\)/\U\1(1)/')" "dont_ask" +prompt APPLICATION_NAME_STYLIZED "The stylized name of the application (for documentation)" "$(echo "$APPLICATION_NAME" sed 's/[_-]/ /g' | sed 's/^\(\w\)/\U\1/g' | sed 's/ \(\w\)/ \U\1/g')" +prompt APPLICATION_NAME_CAPITALIZED_MAN_PART "The capitalized name of the application (for documentation also with a man section part)" "$(echo "$APPLICATION_NAME" | sed 's/_/-/g' | sed 's/\(.*\)/\U\1(1)/')" "dont_ask" prompt APPLICATION_VERSION "The version of this program, without the prefix" "0.1.0" prompt AUTHOR_NAME "The name of the author (or authors)" "$(git config --get user.name)" @@ -60,59 +60,50 @@ prompt AUTHOR_EMAIL "The email of the author (or authors)" "$(git config --get u # cog change-log variables prompt REMOTE "The remote, this project will be pushed to" "git.vhack.eu" -prompt REPOSITORY "The name of the repository in the remote" "$APPLICATION_NAME" +prompt REPOSITORY "The path of the repository on the remote" "$APPLICATION_NAME" prompt OWNER "The name of owner of the repository" "$AUTHOR_NAME" # nice meta data -prompt DESCRIPTION "The description of this project" "[can be empty]" +prompt DESCRIPTION "The description of this project" "" prompt CURRENT_DATE "The stylized version of the current date" "$(date +'%b %Y')" prompt YEAR "The year the work on this has begun (for copyright reasons)" "$(date +'%Y')" prompt APPLICATION_SOURCE_CODE_REPOSITORY "The package's source code repository URL" "https://$REMOTE/$OWNER/$REPOSITORY" +prompt HOME_PAGE "The home page URL of the project" "https://$REPOSITORY.org/" +prompt BUG_URL "The URL people should report bugs to" "$APPLICATION_SOURCE_CODE_REPOSITORY/issues" -# LICENSE.spdx data (source: https://github.com/david-a-wheeler/spdx-tutorial) if [ -e ./lpm.toml ]; then # Use a different default license in latex projects. init_default_license="CC-BY-SA-4.0" else - init_default_license="GPL-3.0-or-later" + init_default_license="AGPL-3.0-or-later" fi -prompt SPDX_LICENSE_IDENTIFIER "THE SPDX identifer of your choosen license" "$init_default_license" -prompt APPLICATION_ORIGINATOR "The person or organization from whom the package originally came" "$AUTHOR_NAME" -prompt APPLICATION_HOME_PAGE "The package's home page URL" "https://$REMOTE/$OWNER/$REPOSITORY" - -echo "Downloading license .." -case "$SPDX_LICENSE_IDENTIFIER" in -"AGPL-3.0-or-later") - default_license_url="https://www.gnu.org/licenses/agpl-3.0.txt" - curl "$default_license_url" >COPYING - ;; -"GPL-3.0-or-later") - default_license_url="https://www.gnu.org/licenses/gpl-3.0.txt" - curl "$default_license_url" >COPYING - ;; -"LGPL-3.0-or-later") - default_license_url="https://www.gnu.org/licenses/lgpl+gpl-3.0.txt" - curl "https://www.gnu.org/licenses/gpl-3.0.txt" >COPYING - curl "https://www.gnu.org/licenses/lgpl-3.0-standalone.html" >COPYING.LESSER - ;; - -"Apache-2.0") - default_license_url="https://www.apache.org/licenses/LICENSE-2.0.txt" - curl "$default_license_url" >LICENSE - ;; - -"CC-BY-SA-4.0") - default_license_url="https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt" - curl "$default_license_url" >LICENSE - ;; - -*) - default_license_url="file:///dev/null" - echo " -> No license found for your identifier: '$SPDX_LICENSE_IDENTIFIER'" - ;; -esac - -prompt LICENSE_URL "The url of the license" "$default_license_url" "dont_ask" +prompt SPDX_LICENSE_IDENTIFIER "THE SPDX identifer of your choosen license" "$init_default_license" "dont_ask" + +default_license_url="$(curl --silent --show-error "https://spdx.org/licenses/$SPDX_LICENSE_IDENTIFIER.json" | jq --raw-output '.seeAlso[0]')" + +# Prefer possible text versions of the license +if curl --fail --silent --show-error "$default_license_url.txt" >/dev/null; then + default_license_url="$default_license_url.txt" +fi +prompt LICENSE_URL "The url of the license" "$default_license_url" +prompt REUSE_TEMPLATE "The template used in reuse annotate" "$( + cat <<EOF | fmt --uniform-spacing --width=75 +{% for copyright_line in copyright_lines %} +{{ copyright_line }} +{% endfor %} +{% for contributor_line in contributor_lines %} +SPDX-FileContributor: {{ contributor_line }} +{% endfor %} +{% for expression in spdx_expressions %} +SPDX-License-Identifier: {{ expression }} +{% endfor %} + +This file is part of $APPLICATION_NAME_STYLIZED - $DESCRIPTION. + +You should have received a copy of the License along with this program. +If not, see <$LICENSE_URL>. +EOF +)" "dont_ask" echo "$DESCRIPTION" >.git/description |