Skip to content

Commit

Permalink
fix!: change possible open_source_license values to string-only (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasPammer authored Sep 22, 2023
1 parent 0243990 commit 07430c1
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 24 deletions.
34 changes: 24 additions & 10 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"code_of_conduct_enforcement_contact_email": "opensource@jonaspammer.at",
"github_username": "JonasPammer",
"open_source_license": [
["MIT License", "MIT"],
["The Unlicense", "Unlicense"],
["Boost Software License 1.0", "BSL-1.0"],
["Apache License 2.0", "Apache-2.0"],
["Mozilla Public License 2.0", "MPL-2.0"],
["GNU LGPLv3", "LGPL-3.0"],
["GNU GPLv3", "GPL-3.0"],
["GNU APGLv3", "AGPL-3.0"],
["Not open source", "None"]
"MIT",
"Unlicense",
"BSL-1.0",
"Apache-2.0",
"MPL-2.0",
"LGPL-3.0",
"GPL-3.0",
"AGPL-3.0",
"None"
],

"galaxy_name": "jonaspammer",
Expand All @@ -23,5 +23,19 @@

"role_name": null,
"project_slug": "ansible-role-{{ cookiecutter.role_name.lower().replace(' ', '_').replace('-', '_') }}",
"project_short_purpose": null
"project_short_purpose": null,

"__prompts__": {
"open_source_license": {
"MIT": "MIT License",
"Unlicense": "The Unlicense",
"BSL-1.0": "Boost Software License 1.0",
"Apache-2.0": "Apache License 2.0",
"MPL-2.0": "Mozilla Public License 2.0",
"LGPL-3.0": "GNU LGPLv3",
"GPL-3.0": "GNU GPLv3",
"AGPL-3.0": "GNU APGLv3",
"None": "Not open source"
}
}
}
12 changes: 8 additions & 4 deletions hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@

assert (
"{%raw%}{{{%endraw%}" not in project_slug
), "'{}' project_slug contains {%raw%}{{{%endraw%}".format(project_slug)
), "project_slug contains {%raw%}{{{%endraw%}! '{}'".format(project_slug)

assert (
"{%raw%}{{{%endraw%}" not in role_name
), "'{}' role_name contains {%raw%}{{{%endraw%}".format(role_name)
), "role_name contains {%raw%}{{{%endraw%}! '{}'".format(role_name)


role_name_ = "{{ cookiecutter.role_name_ | default(None) }}"
if role_name_ is not None:
print("NOTE: role_name_ can be removed from your .cruft.json file (See https://github.com/JonasPammer/cookiecutter-ansible-role/pull/40)".format(role_name_))
if role_name_ != "None":
print(
"NOTE: role_name_ can be removed from your .cruft.json file "
"(See https://github.com/JonasPammer/cookiecutter-ansible-role/pull/40). "
"'{}'".format(role_name_)
)
18 changes: 9 additions & 9 deletions {{ cookiecutter.project_slug }}/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if cookiecutter.open_source_license[1] == 'MIT' -%}
{% if cookiecutter.open_source_license == 'MIT' -%}
MIT License

Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.full_name }}
Expand All @@ -20,7 +20,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
{% elif cookiecutter.open_source_license[1] == 'GPL-3.0' -%}
{% elif cookiecutter.open_source_license == 'GPL-3.0' -%}
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Expand Down Expand Up @@ -695,7 +695,7 @@ may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
{% elif cookiecutter.open_source_license[1] == 'AGPL-3.0' -%}
{% elif cookiecutter.open_source_license == 'AGPL-3.0' -%}
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007

Expand Down Expand Up @@ -1357,7 +1357,7 @@ specific requirements.
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
{% elif cookiecutter.open_source_license[1] == 'LGPL-3.0' -%}
{% elif cookiecutter.open_source_license == 'LGPL-3.0' -%}
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Expand Down Expand Up @@ -1523,7 +1523,7 @@ whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
{% elif cookiecutter.open_source_license[1] == 'MPL-2.0' -%}
{% elif cookiecutter.open_source_license == 'MPL-2.0' -%}
Mozilla Public License Version 2.0
==================================

Expand Down Expand Up @@ -1897,7 +1897,7 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice

This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
{% elif cookiecutter.open_source_license[1] == 'GPL-3.0' -%}
{% elif cookiecutter.open_source_license == 'GPL-3.0' -%}
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -2100,7 +2100,7 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
See the License for the specific language governing permissions and
limitations under the License.

{% elif cookiecutter.open_source_license[1] == 'BSL-1.0' -%}
{% elif cookiecutter.open_source_license == 'BSL-1.0' -%}
Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
Expand All @@ -2124,7 +2124,7 @@ SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
{% elif cookiecutter.open_source_license[1] == 'Unlicense' -%}
{% elif cookiecutter.open_source_license == 'Unlicense' -%}
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
Expand All @@ -2151,4 +2151,4 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>
{% else -%}
This Project is not open source has no explicit license.
{% endif %}
{% endif %}
2 changes: 1 addition & 1 deletion {{ cookiecutter.project_slug }}/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ galaxy_info:
standalone: true

author: "{{ cookiecutter.galaxy_name }}"
license: "{{ cookiecutter.open_source_license[1] }}"
license: "{{ cookiecutter.open_source_license }}"

min_ansible_version: "{{ cookiecutter.min_ansible_version }}"
platforms:
Expand Down

0 comments on commit 07430c1

Please sign in to comment.