Skip to content

Commit

Permalink
chore: use shared template ss-license (#79)
Browse files Browse the repository at this point in the history
Signed-off-by: l.feng <[email protected]>
  • Loading branch information
msclock authored Dec 19, 2024
1 parent 0407d49 commit 9cf78ec
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 16 deletions.
36 changes: 28 additions & 8 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
_exclude:
- .copier-answers.*.yml
- copier.*.yml
- licenses

_envops:
block_end_string: '%]'
Expand Down Expand Up @@ -245,48 +246,67 @@ default_py:

ss_cmake_repo_name:
default: '{{ repo_name }}'
help: 'Provide a name for the repository:'
type: str
when: false

ss_cmake_repo_url:
default: '[% from pathjoin("includes", "variable.jinja") import repo_url with context %]{{ repo_url() }}'
help: 'Provide a url for the repository:'
type: str
when: false

ss_cmake_project_description:
default: '{{ project_description }}'
help: 'Provide a brief description for the project:'
type: str
when: false

ss_cmake_configure_coverage:
default: false
help: Whether to configure coverage in cmake integration for C++.
type: bool
when: false

ss_cmake_configure_version:
default: '{{ compiled }}'
help: Whether to configure to detect git version in cmake integration for C++
type: bool
when: false

ss_cmake_configure_warnings_and_hardening:
default: '{{ compiled }}'
help: Whether to configure warnings and hardening compiling options in cmake integrationo for C++
type: bool
when: false

ss_cmake_use_cpm:
default: '{{ use_cpm }}'
help: Whether to use CPM to manage C++ dependencies that will break up vcpkg dependency management.
type: bool
when: false

ss_cmake_use_conan:
default: '{{ use_conan }}'
help: Whether to use conan to manage C++ dependencies that will break up vcpkg dependency management.
type: bool
when: false

# Override ss-license variables

ss_license_project_name:
default: '{{ project_name }}'
type: str
when: false

ss_license_project_description:
default: '{{ project_description }}'
type: str
when: false

ss_license_copyright_license:
default: '{{ copyright_license }}'
type: str
when: false

ss_license_copyright_year:
default: '{{ copyright_year }}'
type: str
when: false

ss_license_copyright_holder:
default: '{{ copyright_holder }}'
type: str
when: false
3 changes: 3 additions & 0 deletions template/.copier-answers.ss-license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v0.0.1
_src_path: https://github.com/serious-scaffold/ss-license
2 changes: 1 addition & 1 deletion template/LICENSE.jinja
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[%- set license_template = 'includes/licenses/' + copyright_license + '.jinja' -%]
[%- set license_template = 'template/licenses/' + copyright_license + '.jinja' -%]
[%- include license_template -%]
28 changes: 28 additions & 0 deletions template/copier.ss-license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ss_license_project_name:
help: 'Enter the name of the project in CamelCase format:'
type: str

ss_license_project_description:
help: 'Provide a brief description for the project:'
type: str

ss_license_copyright_license:
choices:
- Apache Software License
- Boost Software License 1.0 (BSL-1.0)
- GNU Affero General Public License v3
- GNU General Public License v3 (GPLv3)
- GNU Lesser General Public License v3 (LGPLv3)
- MIT License
- Mozilla Public License 2.0 (MPL 2.0)
- The Unlicense (Unlicense)
help: Choose the project's license (e.g. "MIT", "GPL-3.0").
type: str

ss_license_copyright_year:
help: Enter the copyright year or range (e.g. "2023", "2023-2024").
type: str

ss_license_copyright_holder:
help: Name(s) or organization(s) holding the copyright.
type: str
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {{ copyright_year }} {{ copyright_holder }}
Copyright {{ ss_license_copyright_year }} {{ ss_license_copyright_holder }}

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

{{ project_name }}: {{ project_description }}
Copyright (C) {{ copyright_year }} {{ copyright_holder }}
{{ ss_license_project_name }}: {{ ss_license_project_description }}
Copyright (C) {{ ss_license_copyright_year }} {{ ss_license_copyright_holder }}

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

{{ project_name }}: {{ project_description }}
Copyright (C) {{ copyright_year }} {{ copyright_holder }}
{{ ss_license_project_name }}: {{ ss_license_project_description }}
Copyright (C) {{ ss_license_copyright_year }} {{ ss_license_copyright_holder }}

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

{{ project_name }} Copyright (C) {{ copyright_year }} {{ copyright_holder }}
{{ ss_license_project_name }} Copyright (C) {{ ss_license_copyright_year }} {{ ss_license_copyright_holder }}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) {{ copyright_year }} {{ copyright_holder }}
Copyright (c) {{ ss_license_copyright_year }} {{ ss_license_copyright_holder }}

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down

0 comments on commit 9cf78ec

Please sign in to comment.